@@ -258,7 +258,8 @@ public function hasInstanceProperty(string $propertyName): TrinaryLogic
258
258
return TrinaryLogic::createMaybe ();
259
259
}
260
260
261
- if ($ classReflection ->hasInstanceProperty ($ propertyName )) {
261
+ $ classHasProperty = RecursionGuard::run ($ this , static fn (): bool => $ classReflection ->hasInstanceProperty ($ propertyName ));
262
+ if ($ classHasProperty === true || $ classHasProperty instanceof ErrorType) {
262
263
return TrinaryLogic::createYes ();
263
264
}
264
265
@@ -324,7 +325,17 @@ public function getUnresolvedInstancePropertyPrototype(string $propertyName, Cla
324
325
throw new ClassNotFoundException ($ this ->className );
325
326
}
326
327
327
- $ property = $ nakedClassReflection ->getInstanceProperty ($ propertyName , $ scope );
328
+ $ property = RecursionGuard::run ($ this , static fn () => $ nakedClassReflection ->getInstanceProperty ($ propertyName , $ scope ));
329
+ if ($ property instanceof ErrorType) {
330
+ $ property = new DummyPropertyReflection ($ propertyName );
331
+
332
+ return new CallbackUnresolvedPropertyPrototypeReflection (
333
+ $ property ,
334
+ $ property ->getDeclaringClass (),
335
+ false ,
336
+ static fn (Type $ type ): Type => $ type ,
337
+ );
338
+ }
328
339
329
340
$ ancestor = $ this ->getAncestorWithClassName ($ property ->getDeclaringClass ()->getName ());
330
341
$ resolvedClassReflection = null ;
@@ -353,7 +364,8 @@ public function hasStaticProperty(string $propertyName): TrinaryLogic
353
364
return TrinaryLogic::createMaybe ();
354
365
}
355
366
356
- if ($ classReflection ->hasStaticProperty ($ propertyName )) {
367
+ $ classHasProperty = RecursionGuard::run ($ this , static fn (): bool => $ classReflection ->hasStaticProperty ($ propertyName ));
368
+ if ($ classHasProperty === true || $ classHasProperty instanceof ErrorType) {
357
369
return TrinaryLogic::createYes ();
358
370
}
359
371
@@ -395,7 +407,17 @@ public function getUnresolvedStaticPropertyPrototype(string $propertyName, Class
395
407
throw new ClassNotFoundException ($ this ->className );
396
408
}
397
409
398
- $ property = $ nakedClassReflection ->getStaticProperty ($ propertyName );
410
+ $ property = RecursionGuard::run ($ this , static fn () => $ nakedClassReflection ->getStaticProperty ($ propertyName , $ scope ));
411
+ if ($ property instanceof ErrorType) {
412
+ $ property = new DummyPropertyReflection ($ propertyName );
413
+
414
+ return new CallbackUnresolvedPropertyPrototypeReflection (
415
+ $ property ,
416
+ $ property ->getDeclaringClass (),
417
+ false ,
418
+ static fn (Type $ type ): Type => $ type ,
419
+ );
420
+ }
399
421
400
422
$ ancestor = $ this ->getAncestorWithClassName ($ property ->getDeclaringClass ()->getName ());
401
423
$ resolvedClassReflection = null ;
0 commit comments