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