1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-11 16:59:45 +01:00

Fix while loop unset issue

This commit is contained in:
Matthew Brown 2016-10-02 10:26:13 -04:00
parent 91ea6844ba
commit ff17dcf1ee

View File

@ -2030,6 +2030,7 @@ class StatementsChecker
continue;
}
if (isset($while_context->vars_in_scope[$var])) {
if ($while_context->vars_in_scope[$var]->isMixed()) {
$context->vars_in_scope[$var] = $while_context->vars_in_scope[$var];
}
@ -2038,6 +2039,7 @@ class StatementsChecker
$context->vars_in_scope[$var] = Type::combineUnionTypes($while_context->vars_in_scope[$var], $type);
}
}
}
$context->vars_possibly_in_scope = array_merge($context->vars_possibly_in_scope, $while_context->vars_possibly_in_scope);
}