1--TEST-- 2Lazy objects: clone returns an object of the same class 3--FILE-- 4<?php 5 6class A { 7 public function __construct( 8 public string $property, 9 ) {} 10} 11class B extends A { 12 public function foo() { } 13} 14 15function only_b(B $b) { $b->foo(); } 16 17$r = new ReflectionClass(B::class); 18$b = $r->newLazyProxy(function ($obj) { 19 return new A('value'); 20}); 21 22$b->property = 'init_please'; 23 24$clone = clone $b; 25only_b($b); 26only_b($clone); 27 28var_dump($b::class); 29var_dump($clone::class); 30 31?> 32==DONE== 33--EXPECT-- 34string(1) "B" 35string(1) "B" 36==DONE== 37