$this->
assertSame(['public', "\0".TestClass::
class."\0lazyObjectState"
],
array_keys((array) $instance));
$this->
assertSame(1,
$counter);
$instance->
initializeLazyObject();
$this->
assertTrue($instance->
isLazyObjectInitialized());
$this->
assertSame(123,
$instance->public
);
$this->
assertSame(6,
$counter);
$properties =
(array) $instance;
$this->
assertInstanceOf(LazyObjectState::
class,
$properties["\0".TestClass::
class."\0lazyObjectState"
]);
unset($properties["\0".TestClass::
class."\0lazyObjectState"
]);
$this->
assertSame(array_keys((array) new ChildTestClass()),
array_keys($properties));
$this->
assertSame([123, 345, 456, 567, 234, 678
],
array_values($properties));
} public function testPartialInitializationWithReset() { $initializer =
static fn (ChildTestClass
$instance, string
$property, ?string
$scope, mixed
$default) => 234;
$instance = ChildTestClass::
createLazyGhost([ 'public' =>
$initializer,
'publicReadonly' =>
$initializer,
"\0*\0protected" =>
$initializer,
]);