1--TEST-- 2Lazy objects: resetAsLazy*() accept a sub-class of the reflected class 3--FILE-- 4<?php 5 6class A { 7 public $a; 8} 9class B extends A {} 10 11class C {} 12 13$reflector = new ReflectionClass(A::class); 14 15$reflector->resetAsLazyGhost(new A(), function () {}); 16$reflector->resetAsLazyGhost(new B(), function () {}); 17 18try { 19 $reflector->resetAsLazyGhost(new C(), function () {}); 20} catch (TypeError $e) { 21 printf("%s: %s\n", $e::class, $e->getMessage()); 22} 23 24?> 25==DONE== 26--EXPECT-- 27TypeError: ReflectionClass::resetAsLazyGhost(): Argument #1 ($object) must be of type A, C given 28==DONE== 29