@@ -227,7 +227,7 @@ public function testGetValueThrowsExceptionIfUninitializedPropertyWithGetterOfAn
227227 $ this ->expectException (UninitializedPropertyException::class);
228228 $ this ->expectExceptionMessage ('The method "Symfony\Component\PropertyAccess\Tests\Fixtures\UninitializedPrivateProperty@anonymous::getUninitialized()" returned "null", but expected type "array". Did you forget to initialize a property or to make the return type nullable using "?array"? ' );
229229
230- $ object = new class () extends \ Symfony \ Component \ PropertyAccess \ Tests \ Fixtures \ UninitializedPrivateProperty {
230+ $ object = new class () extends UninitializedPrivateProperty {
231231 };
232232
233233 $ this ->propertyAccessor ->getValue ($ object , 'uninitialized ' );
@@ -978,20 +978,6 @@ public function testGetValueGetterThrowsExceptionIfUninitializedWithoutLazyGhost
978978 $ this ->propertyAccessor ->getValue (new UninitializedObjectProperty (), 'privateUninitialized ' );
979979 }
980980
981- private function createUninitializedObjectPropertyGhost (): UninitializedObjectProperty
982- {
983- $ class = 'UninitializedObjectPropertyGhost ' ;
984-
985- if (!class_exists ($ class )) {
986- eval ('class ' .$ class .ProxyHelper::generateLazyGhost (new \ReflectionClass (UninitializedObjectProperty::class)));
987- }
988-
989- $ this ->assertTrue (class_exists ($ class ));
990-
991- return $ class ::createLazyGhost (initializer: function ($ instance ) {
992- });
993- }
994-
995981 public function testGetValuePropertyThrowsExceptionIfUninitializedWithLazyGhost ()
996982 {
997983 $ this ->expectException (UninitializedPropertyException::class);
@@ -1011,4 +997,22 @@ public function testGetValueGetterThrowsExceptionIfUninitializedWithLazyGhost()
1011997
1012998 $ this ->propertyAccessor ->getValue ($ lazyGhost , 'privateUninitialized ' );
1013999 }
1000+
1001+ private function createUninitializedObjectPropertyGhost (): UninitializedObjectProperty
1002+ {
1003+ if (!class_exists (ProxyHelper::class)) {
1004+ $ this ->markTestSkipped (sprintf ('Class "%s" is required to run this test. ' , ProxyHelper::class));
1005+ }
1006+
1007+ $ class = 'UninitializedObjectPropertyGhost ' ;
1008+
1009+ if (!class_exists ($ class )) {
1010+ eval ('class ' .$ class .ProxyHelper::generateLazyGhost (new \ReflectionClass (UninitializedObjectProperty::class)));
1011+ }
1012+
1013+ $ this ->assertTrue (class_exists ($ class ));
1014+
1015+ return $ class ::createLazyGhost (initializer: function ($ instance ) {
1016+ });
1017+ }
10141018}
0 commit comments