1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-03 18:17:55 +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,12 +2030,14 @@ class StatementsChecker
continue;
}
if ($while_context->vars_in_scope[$var]->isMixed()) {
$context->vars_in_scope[$var] = $while_context->vars_in_scope[$var];
}
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];
}
if ((string) $while_context->vars_in_scope[$var] !== (string) $type) {
$context->vars_in_scope[$var] = Type::combineUnionTypes($while_context->vars_in_scope[$var], $type);
if ((string) $while_context->vars_in_scope[$var] !== (string) $type) {
$context->vars_in_scope[$var] = Type::combineUnionTypes($while_context->vars_in_scope[$var], $type);
}
}
}