1--TEST--
2Promoted readonly property
3--FILE--
4<?php
5
6class Point {
7    public function __construct(
8        public readonly float $x = 0.0,
9        public readonly float $y = 0.0,
10        public readonly float $z = 0.0,
11    ) {}
12}
13
14var_dump(new Point);
15$point = new Point(1.0, 2.0, 3.0);
16try {
17    $point->x = 4.0;
18} catch (Error $e) {
19    echo $e->getMessage(), "\n";
20}
21var_dump($point);
22
23?>
24--EXPECT--
25object(Point)#1 (3) {
26  ["x"]=>
27  float(0)
28  ["y"]=>
29  float(0)
30  ["z"]=>
31  float(0)
32}
33Cannot modify readonly property Point::$x
34object(Point)#1 (3) {
35  ["x"]=>
36  float(1)
37  ["y"]=>
38  float(2)
39  ["z"]=>
40  float(3)
41}
42