1--TEST--
2Set from __set respects set visibility
3--FILE--
4<?php
5
6class C {
7    public private(set) int $a = 1;
8    public function __construct() {
9        unset($this->a);
10    }
11}
12
13class D extends C {
14    public function __set($name, $value) {
15        $this->a = $value;
16    }
17}
18
19$c = new D();
20try {
21    $c->a = 2;
22} catch (Error $e) {
23    echo $e->getMessage(), "\n";
24}
25var_dump($c);
26
27?>
28--EXPECTF--
29Cannot modify private(set) property C::$a from scope D
30object(D)#%d (0) {
31  ["a"]=>
32  uninitialized(int)
33}
34