@@ -512,10 +512,8 @@ public function getCallableParametersAcceptors(ClassMemberAccessAnswerer $scope)
512512 return $ acceptors ;
513513 }
514514
515- /**
516- * @return array{Type, Type}|array{}
517- */
518- private function getClassOrObjectAndMethods (): array
515+ /** @return ConstantArrayTypeAndMethod[] */
516+ public function findTypeAndMethodNames (): array
519517 {
520518 if (count ($ this ->keyTypes ) !== 2 ) {
521519 return [];
@@ -540,16 +538,7 @@ private function getClassOrObjectAndMethods(): array
540538 return [];
541539 }
542540
543- return [$ classOrObject , $ method ];
544- }
545-
546- /** @return ConstantArrayTypeAndMethod[] */
547- public function findTypeAndMethodNames (): array
548- {
549- $ callableArray = $ this ->getClassOrObjectAndMethods ();
550- if ($ callableArray === []) {
551- return [];
552- }
541+ $ callableArray = [$ classOrObject , $ method ];
553542
554543 [$ classOrObject , $ methods ] = $ callableArray ;
555544 if (count ($ methods ->getConstantStrings ()) === 0 ) {
@@ -563,8 +552,8 @@ public function findTypeAndMethodNames(): array
563552
564553 $ typeAndMethods = [];
565554 $ phpVersion = PhpVersionStaticAccessor::getInstance ();
566- foreach ($ methods ->getConstantStrings () as $ method ) {
567- $ has = $ type ->hasMethod ($ method ->getValue ());
555+ foreach ($ methods ->getConstantStrings () as $ methodName ) {
556+ $ has = $ type ->hasMethod ($ methodName ->getValue ());
568557 if ($ has ->no ()) {
569558 continue ;
570559 }
@@ -573,7 +562,7 @@ public function findTypeAndMethodNames(): array
573562 $ has ->yes ()
574563 && !$ phpVersion ->supportsCallableInstanceMethods ()
575564 ) {
576- $ methodReflection = $ type ->getMethod ($ method ->getValue (), new OutOfClassScope ());
565+ $ methodReflection = $ type ->getMethod ($ methodName ->getValue (), new OutOfClassScope ());
577566 if ($ classOrObject ->isString ()->yes () && !$ methodReflection ->isStatic ()) {
578567 continue ;
579568 }
@@ -583,7 +572,7 @@ public function findTypeAndMethodNames(): array
583572 $ has = $ has ->and (TrinaryLogic::createMaybe ());
584573 }
585574
586- $ typeAndMethods [] = ConstantArrayTypeAndMethod::createConcrete ($ type , $ method ->getValue (), $ has );
575+ $ typeAndMethods [] = ConstantArrayTypeAndMethod::createConcrete ($ type , $ methodName ->getValue (), $ has );
587576 }
588577
589578 return $ typeAndMethods ;
0 commit comments