1--TEST--
2Asymmetric visibility __unset
3--FILE--
4<?php
5
6class Foo {
7    public private(set) string $bar;
8
9    public function setBar($bar) {
10        $this->bar = $bar;
11    }
12
13    public function unsetBar() {
14        unset($this->bar);
15    }
16
17    public function __unset($name) {
18        echo __METHOD__, "\n";
19    }
20}
21
22function test($foo) {
23    try {
24        unset($foo->bar);
25    } catch (Error $e) {
26        echo $e->getMessage(), "\n";
27    }
28}
29
30$foo = new Foo();
31test($foo);
32
33$foo->unsetBar();
34test($foo);
35
36$foo->setBar('bar');
37test($foo);
38
39$foo->unsetBar();
40test($foo);
41
42?>
43--EXPECT--
44Cannot unset private(set) property Foo::$bar from global scope
45Foo::__unset
46Cannot unset private(set) property Foo::$bar from global scope
47Foo::__unset
48