1--TEST--
2Visibility can change in readonly property
3--FILE--
4<?php
5
6class A {
7    protected readonly int $prop;
8
9    public function __construct() {
10        $this->prop = 42;
11    }
12}
13class B extends A {
14    public readonly int $prop;
15}
16
17$a = new A();
18try {
19    var_dump($a->prop);
20} catch (Error $error) {
21    echo $error->getMessage() . "\n";
22}
23
24$b = new B();
25var_dump($b->prop);
26
27?>
28--EXPECT--
29Cannot access protected property A::$prop
30int(42)
31