@@ -512,10 +512,8 @@ public function getCallableParametersAcceptors(ClassMemberAccessAnswerer $scope)
512
512
return $ acceptors ;
513
513
}
514
514
515
- /**
516
- * @return array{Type, Type}|array{}
517
- */
518
- private function getClassOrObjectAndMethods (): array
515
+ /** @return ConstantArrayTypeAndMethod[] */
516
+ public function findTypeAndMethodNames (): array
519
517
{
520
518
if (count ($ this ->keyTypes ) !== 2 ) {
521
519
return [];
@@ -540,16 +538,7 @@ private function getClassOrObjectAndMethods(): array
540
538
return [];
541
539
}
542
540
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 ];
553
542
554
543
[$ classOrObject , $ methods ] = $ callableArray ;
555
544
if (count ($ methods ->getConstantStrings ()) === 0 ) {
@@ -563,8 +552,8 @@ public function findTypeAndMethodNames(): array
563
552
564
553
$ typeAndMethods = [];
565
554
$ 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 ());
568
557
if ($ has ->no ()) {
569
558
continue ;
570
559
}
@@ -573,7 +562,7 @@ public function findTypeAndMethodNames(): array
573
562
$ has ->yes ()
574
563
&& !$ phpVersion ->supportsCallableInstanceMethods ()
575
564
) {
576
- $ methodReflection = $ type ->getMethod ($ method ->getValue (), new OutOfClassScope ());
565
+ $ methodReflection = $ type ->getMethod ($ methodName ->getValue (), new OutOfClassScope ());
577
566
if ($ classOrObject ->isString ()->yes () && !$ methodReflection ->isStatic ()) {
578
567
continue ;
579
568
}
@@ -583,7 +572,7 @@ public function findTypeAndMethodNames(): array
583
572
$ has = $ has ->and (TrinaryLogic::createMaybe ());
584
573
}
585
574
586
- $ typeAndMethods [] = ConstantArrayTypeAndMethod::createConcrete ($ type , $ method ->getValue (), $ has );
575
+ $ typeAndMethods [] = ConstantArrayTypeAndMethod::createConcrete ($ type , $ methodName ->getValue (), $ has );
587
576
}
588
577
589
578
return $ typeAndMethods ;
0 commit comments