@@ -458,7 +458,7 @@ public function equals(Type $type): bool
458
458
459
459
public function isCallable (): TrinaryLogic
460
460
{
461
- $ typeAndMethods = $ this ->findTypeAndMethodNames (false );
461
+ $ typeAndMethods = $ this ->findTypeAndMethodNames ();
462
462
if ($ typeAndMethods === []) {
463
463
return TrinaryLogic::createNo ();
464
464
}
@@ -468,7 +468,19 @@ public function isCallable(): TrinaryLogic
468
468
$ typeAndMethods ,
469
469
);
470
470
471
- return TrinaryLogic::extremeIdentity (...$ results );
471
+ $ isCallable = TrinaryLogic::createYes ()->and (...$ results );
472
+ if ($ isCallable ->yes ()) {
473
+ $ callableArray = $ this ->getClassOrObjectAndMethods ();
474
+ if ($ callableArray !== []) {
475
+ [$ classOrObject , $ methods ] = $ callableArray ;
476
+
477
+ if (count ($ methods ->getConstantStrings ()) !== count ($ typeAndMethods )) {
478
+ return TrinaryLogic::createMaybe ();
479
+ }
480
+ }
481
+ }
482
+
483
+ return $ isCallable ;
472
484
}
473
485
474
486
public function getCallableParametersAcceptors (ClassMemberAccessAnswerer $ scope ): array
@@ -561,7 +573,7 @@ public function findTypeAndMethodName(): ?ConstantArrayTypeAndMethod
561
573
}
562
574
563
575
/** @return ConstantArrayTypeAndMethod[] */
564
- public function findTypeAndMethodNames (bool $ atLeastMaybe = true ): array
576
+ public function findTypeAndMethodNames (): array
565
577
{
566
578
$ callableArray = $ this ->getClassOrObjectAndMethods ();
567
579
if ($ callableArray === []) {
@@ -582,21 +594,25 @@ public function findTypeAndMethodNames(bool $atLeastMaybe = true): array
582
594
$ phpVersion = PhpVersionStaticAccessor::getInstance ();
583
595
foreach ($ methods ->getConstantStrings () as $ method ) {
584
596
$ has = $ type ->hasMethod ($ method ->getValue ());
597
+ if ($ has ->no ()) {
598
+ continue ;
599
+ }
585
600
586
- if ($ has -> yes ()) {
587
- if ( BleedingEdgeToggle::isBleedingEdge () && ! $ phpVersion -> supportsCallableInstanceMethods ()) {
588
- $ methodReflection = $ type -> getMethod ( $ method -> getValue (), new OutOfClassScope ());
589
- if ( $ classOrObject -> isString ()-> yes () && !$ methodReflection -> isStatic ()) {
590
- $ has = TrinaryLogic:: createNo ();
591
- }
592
- } elseif ( $ this -> isOptionalKey ( 0 ) || $ this -> isOptionalKey ( 1 )) {
593
- $ has = $ has -> and (TrinaryLogic:: createMaybe ()) ;
601
+ if (
602
+ BleedingEdgeToggle::isBleedingEdge ()
603
+ && $ has -> yes ()
604
+ && !$ phpVersion -> supportsCallableInstanceMethods ()
605
+ ) {
606
+ $ methodReflection = $ type -> getMethod ( $ method -> getValue (), new OutOfClassScope ());
607
+ if ( $ classOrObject -> isString ()-> yes () && ! $ methodReflection -> isStatic ( )) {
608
+ continue ;
594
609
}
595
610
}
596
611
597
- if ($ atLeastMaybe && $ has -> no ( )) {
598
- continue ;
612
+ if ($ this -> isOptionalKey ( 0 ) || $ this -> isOptionalKey ( 1 )) {
613
+ $ has = $ has -> and (TrinaryLogic:: createMaybe ()) ;
599
614
}
615
+
600
616
$ typeAndMethods [] = ConstantArrayTypeAndMethod::createConcrete ($ type , $ method ->getValue (), $ has );
601
617
}
602
618
0 commit comments