@@ -792,8 +792,7 @@ private function handleAll(
792
792
TypeSpecifierContext::createTruthy ()
793
793
);
794
794
795
- $ typeBefore = $ scope ->getType ($ node ->getArgs ()[0 ]->value );
796
- $ type = $ this ->determineVariableTypeFromSpecifiedTypes ($ typeBefore , $ specifiedTypes );
795
+ $ type = $ this ->determineVariableTypeFromSpecifiedTypes ($ scope , $ specifiedTypes );
797
796
798
797
return $ this ->arrayOrIterable (
799
798
$ scope ,
@@ -829,8 +828,7 @@ private function handleNullOr(
829
828
TypeSpecifierContext::createTruthy ()
830
829
);
831
830
832
- $ typeBefore = $ scope ->getType ($ node ->getArgs ()[0 ]->value );
833
- $ type = $ this ->determineVariableTypeFromSpecifiedTypes ($ typeBefore , $ specifiedTypes );
831
+ $ type = $ this ->determineVariableTypeFromSpecifiedTypes ($ scope , $ specifiedTypes );
834
832
835
833
return $ this ->typeSpecifier ->create ($ node ->getArgs ()[0 ]->value , TypeCombinator::addNull ($ type ), TypeSpecifierContext::createTruthy (), false , $ scope );
836
834
}
@@ -872,7 +870,7 @@ private function arrayOrIterable(
872
870
);
873
871
}
874
872
875
- private function determineVariableTypeFromSpecifiedTypes (Type $ typeBefore , SpecifiedTypes $ specifiedTypes ): Type
873
+ private function determineVariableTypeFromSpecifiedTypes (Scope $ scope , SpecifiedTypes $ specifiedTypes ): Type
876
874
{
877
875
if (count ($ specifiedTypes ->getSureTypes ()) > 0 ) {
878
876
$ sureTypes = $ specifiedTypes ->getSureTypes ();
@@ -890,9 +888,9 @@ private function determineVariableTypeFromSpecifiedTypes(Type $typeBefore, Speci
890
888
if (count ($ specifiedTypes ->getSureNotTypes ()) > 0 ) {
891
889
$ sureNotTypes = $ specifiedTypes ->getSureNotTypes ();
892
890
$ exprString = key ($ sureNotTypes );
893
- [, $ type ] = $ sureNotTypes [$ exprString ];
891
+ [$ exprNode , $ type ] = $ sureNotTypes [$ exprString ];
894
892
895
- return TypeCombinator::remove ($ typeBefore , $ type );
893
+ return TypeCombinator::remove ($ scope -> getType ( $ exprNode ) , $ type );
896
894
}
897
895
898
896
throw new ShouldNotHappenException ();
0 commit comments