1--TEST-- 2Test ReflectionProperty::setValue() error cases. 3--FILE-- 4<?php 5 6enum Foo: int { 7 case Bar = 0; 8} 9 10$reflection = new ReflectionProperty(Foo::class, 'value'); 11 12try { 13 $reflection->setValue(Foo::Bar, 1); 14} catch (Error $e) { 15 echo $e->getMessage() . "\n"; 16} 17 18var_dump(Foo::Bar->value); 19 20?> 21--EXPECT-- 22Cannot modify readonly property Foo::$value 23int(0) 24