1--TEST--
2Asymmetric visibility private(set) CPP
3--FILE--
4<?php
5
6class Foo {
7    public function __construct(
8        public private(set) string $bar,
9    ) {}
10
11    public function setBar($bar) {
12        $this->bar = $bar;
13    }
14}
15
16$foo = new Foo('bar');
17var_dump($foo->bar);
18
19try {
20    $foo->bar = 'baz';
21} catch (Error $e) {
22    echo $e->getMessage(), "\n";
23}
24
25$foo->setBar('baz');
26var_dump($foo->bar);
27
28?>
29--EXPECT--
30string(3) "bar"
31Cannot modify private(set) property Foo::$bar from global scope
32string(3) "baz"
33