1--TEST-- 2Lazy objects: initialization of proxy does not change the class of the object 3--FILE-- 4<?php 5 6 7class A { 8 public string $s; 9} 10class B extends A { 11 public function foo() { 12 var_dump(__METHOD__); 13 } 14} 15 16$reflector = new ReflectionClass(B::class); 17$o = $reflector->newLazyProxy(function (B $o) { 18 return new A(); 19}); 20 21var_dump(get_class($o)); 22$o->foo(); 23$o->s = 'init'; 24var_dump(get_class($o)); 25$o->foo(); 26 27 28?> 29--EXPECT-- 30string(1) "B" 31string(6) "B::foo" 32string(1) "B" 33string(6) "B::foo" 34