Skip to content

Commit 271382e

Browse files
committed
simplify
1 parent 500fa9c commit 271382e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Analyser/MutatingScope.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -552,14 +552,12 @@ public function getVariableType(string $variableName): Type
552552
throw new UndefinedVariableException($this, $variableName);
553553
}
554554

555-
$defaultType = new MixedType();
556-
if ($this->isGlobalVariable($variableName)) {
557-
$defaultType = new ArrayType(new BenevolentUnionType([new IntegerType(), new StringType()]), new MixedType(true));
558-
}
559-
560555
$varExprString = '$' . $variableName;
561556
if (!array_key_exists($varExprString, $this->expressionTypes)) {
562-
return $defaultType;
557+
if ($this->isGlobalVariable($variableName)) {
558+
return new ArrayType(new BenevolentUnionType([new IntegerType(), new StringType()]), new MixedType(true));
559+
}
560+
return new MixedType();
563561
}
564562

565563
return TypeUtils::resolveLateResolvableTypes($this->expressionTypes[$varExprString]->getType());

0 commit comments

Comments
 (0)