@@ -98,7 +98,6 @@ public function __construct(
9898 private ReflectionProvider \ReflectionProviderProvider $ reflectionProviderProvider ,
9999 private FileTypeMapper $ fileTypeMapper ,
100100 private bool $ inferPrivatePropertyTypeFromConstructor ,
101- private array $ universalObjectCratesClasses ,
102101 )
103102 {
104103 }
@@ -398,20 +397,7 @@ public function getMethod(ClassReflection $classReflection, string $methodName):
398397
399398 public function hasNativeMethod (ClassReflection $ classReflection , string $ methodName ): bool
400399 {
401- $ hasMethod = $ this ->hasMethod ($ classReflection , $ methodName );
402- if ($ hasMethod ) {
403- return true ;
404- }
405-
406- if ($ methodName === '__get ' && UniversalObjectCratesClassReflectionExtension::isUniversalObjectCrate (
407- $ this ->reflectionProviderProvider ->getReflectionProvider (),
408- $ this ->universalObjectCratesClasses ,
409- $ classReflection ,
410- )) {
411- return true ;
412- }
413-
414- return false ;
400+ return $ this ->hasMethod ($ classReflection , $ methodName );
415401 }
416402
417403 public function getNativeMethod (ClassReflection $ classReflection , string $ methodName ): ExtendedMethodReflection
@@ -420,27 +406,14 @@ public function getNativeMethod(ClassReflection $classReflection, string $method
420406 return $ this ->nativeMethods [$ classReflection ->getCacheKey ()][$ methodName ];
421407 }
422408
423- if ($ classReflection ->getNativeReflection ()->hasMethod ($ methodName )) {
424- $ nativeMethodReflection = new NativeBuiltinMethodReflection (
425- $ classReflection ->getNativeReflection ()->getMethod ($ methodName ),
426- );
427- } else {
428- if (
429- $ methodName !== '__get '
430- || !UniversalObjectCratesClassReflectionExtension::isUniversalObjectCrate (
431- $ this ->reflectionProviderProvider ->getReflectionProvider (),
432- $ this ->universalObjectCratesClasses ,
433- $ classReflection ,
434- )) {
435- throw new ShouldNotHappenException ();
436- }
437-
438- $ nativeMethodReflection = new FakeBuiltinMethodReflection (
439- $ methodName ,
440- $ classReflection ->getNativeReflection (),
441- );
409+ if (!$ classReflection ->getNativeReflection ()->hasMethod ($ methodName )) {
410+ throw new ShouldNotHappenException ();
442411 }
443412
413+ $ nativeMethodReflection = new NativeBuiltinMethodReflection (
414+ $ classReflection ->getNativeReflection ()->getMethod ($ methodName ),
415+ );
416+
444417 if (!isset ($ this ->nativeMethods [$ classReflection ->getCacheKey ()][$ nativeMethodReflection ->getName ()])) {
445418 $ method = $ this ->createMethod ($ classReflection , $ nativeMethodReflection , false );
446419 $ this ->nativeMethods [$ classReflection ->getCacheKey ()][$ nativeMethodReflection ->getName ()] = $ method ;
0 commit comments