1--TEST-- 2ReflectionProperty::is{Private,Protected}Set 3--FILE-- 4<?php 5 6class Foo { 7 public private(set) int $bar = 0; 8 public protected(set) int $baz = 0; 9} 10 11function test($property) { 12 static $i = 0; 13 $foo = new Foo(); 14 $reflectionProperty = new ReflectionProperty(Foo::class, $property); 15 $reflectionProperty->setValue($foo, $i++); 16 var_dump($reflectionProperty->getValue($foo)); 17} 18 19test('bar'); 20test('baz'); 21 22?> 23--EXPECT-- 24int(0) 25int(1) 26