@@ -324,7 +324,17 @@ public function getUnresolvedInstancePropertyPrototype(string $propertyName, Cla
324324 throw new ClassNotFoundException ($ this ->className );
325325 }
326326
327- $ property = $ nakedClassReflection ->getInstanceProperty ($ propertyName , $ scope );
327+ $ property = RecursionGuard::run ($ this , static fn () => $ nakedClassReflection ->getInstanceProperty ($ propertyName , $ scope ));
328+ if ($ property instanceof ErrorType) {
329+ $ property = new DummyPropertyReflection ($ propertyName );
330+
331+ return new CallbackUnresolvedPropertyPrototypeReflection (
332+ $ property ,
333+ $ property ->getDeclaringClass (),
334+ false ,
335+ static fn (Type $ type ): Type => $ type ,
336+ );
337+ }
328338
329339 $ ancestor = $ this ->getAncestorWithClassName ($ property ->getDeclaringClass ()->getName ());
330340 $ resolvedClassReflection = null ;
@@ -395,7 +405,17 @@ public function getUnresolvedStaticPropertyPrototype(string $propertyName, Class
395405 throw new ClassNotFoundException ($ this ->className );
396406 }
397407
398- $ property = $ nakedClassReflection ->getStaticProperty ($ propertyName );
408+ $ property = RecursionGuard::run ($ this , static fn () => $ nakedClassReflection ->getStaticProperty ($ propertyName , $ scope ));
409+ if ($ property instanceof ErrorType) {
410+ $ property = new DummyPropertyReflection ($ propertyName );
411+
412+ return new CallbackUnresolvedPropertyPrototypeReflection (
413+ $ property ,
414+ $ property ->getDeclaringClass (),
415+ false ,
416+ static fn (Type $ type ): Type => $ type ,
417+ );
418+ }
399419
400420 $ ancestor = $ this ->getAncestorWithClassName ($ property ->getDeclaringClass ()->getName ());
401421 $ resolvedClassReflection = null ;
0 commit comments