Skip to content

Commit d40ba5d

Browse files
committed
move check on defined variables on last resort after other check
1 parent d32d28d commit d40ba5d

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎src/NodeAnalyzer/ExprAnalyzer.php‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ public function isNonTypedFromParam(Expr $expr): bool
169169
return true;
170170
}
171171

172+
if ($nativeType instanceof UnionType && ! $nativeType->equals($type)) {
173+
return true;
174+
}
175+
176+
if (! $nativeType->isSuperTypeOf($type)
177+
->yes()) {
178+
return true;
179+
}
180+
172181
$definedVariables = $scope->getDefinedVariables();
173182
foreach ($definedVariables as $definedVariable) {
174183
$variableType = $scope->getVariableType($definedVariable);
@@ -178,12 +187,7 @@ public function isNonTypedFromParam(Expr $expr): bool
178187
}
179188
}
180189

181-
if ($nativeType instanceof UnionType) {
182-
return ! $nativeType->equals($type);
183-
}
184-
185-
return ! $nativeType->isSuperTypeOf($type)
186-
->yes();
190+
return false;
187191
}
188192

189193
public function isDynamicExpr(Expr $expr): bool

0 commit comments

Comments
 (0)