1--TEST--
2Normal properties of a readonly class are implicitly declared as readonly
3--FILE--
4<?php
5
6readonly class Foo
7{
8    public int $bar;
9
10    public function __construct() {
11        $this->bar = 1;
12    }
13}
14
15$foo = new Foo();
16
17try {
18    $foo->bar = 2;
19} catch (Error $exception) {
20    echo $exception->getMessage() . "\n";
21}
22
23?>
24--EXPECT--
25Cannot modify readonly property Foo::$bar
26