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