mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Use mixed type if we detect expression error
This commit is contained in:
parent
162a8a2c2b
commit
6f9cb1d99c
@ -1476,7 +1476,12 @@ class StatementsChecker
|
||||
|
||||
protected function _checkAssignment(PhpParser\Node\Expr\Assign $stmt, Context $context)
|
||||
{
|
||||
$var_id = self::getVarId($stmt->var);
|
||||
|
||||
if ($this->_checkExpression($stmt->expr, $context) === false) {
|
||||
// if we're not exiting immediately, make everything mixed
|
||||
$context->vars_in_scope[$var_id] = Type::getMixed();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1506,8 +1511,6 @@ class StatementsChecker
|
||||
}
|
||||
}
|
||||
|
||||
$var_id = self::getVarId($stmt->var);
|
||||
|
||||
if ($type_in_comments_var_id && $type_in_comments_var_id !== $var_id) {
|
||||
if (isset($context->vars_in_scope[$type_in_comments_var_id])) {
|
||||
$context->vars_in_scope[$type_in_comments_var_id] = Type::parseString($type_in_comments);
|
||||
|
Loading…
Reference in New Issue
Block a user