File tree 1 file changed +7
-10
lines changed
1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -548,21 +548,18 @@ public function getVariableType(string $variableName): Type
548
548
}
549
549
}
550
550
551
- $ varExprString = '$ ' . $ variableName ;
552
- if ($ this ->isGlobalVariable ($ variableName )) {
553
- if (array_key_exists ($ varExprString , $ this ->expressionTypes )) {
554
- return TypeUtils::resolveLateResolvableTypes ($ this ->expressionTypes [$ varExprString ]->getType ());
555
- }
556
-
557
- return new ArrayType (new BenevolentUnionType ([new IntegerType (), new StringType ()]), new MixedType (true ));
558
- }
559
-
560
551
if ($ this ->hasVariableType ($ variableName )->no ()) {
561
552
throw new UndefinedVariableException ($ this , $ variableName );
562
553
}
563
554
555
+ $ defaultType = new MixedType ();
556
+ if ($ this ->isGlobalVariable ($ variableName )) {
557
+ $ defaultType = new ArrayType (new BenevolentUnionType ([new IntegerType (), new StringType ()]), new MixedType (true ));
558
+ }
559
+
560
+ $ varExprString = '$ ' . $ variableName ;
564
561
if (!array_key_exists ($ varExprString , $ this ->expressionTypes )) {
565
- return new MixedType () ;
562
+ return $ defaultType ;
566
563
}
567
564
568
565
return TypeUtils::resolveLateResolvableTypes ($ this ->expressionTypes [$ varExprString ]->getType ());
You can’t perform that action at this time.
0 commit comments