1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-04 02:27:59 +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; continue;
} }
if ($while_context->vars_in_scope[$var]->isMixed()) { if (isset($while_context->vars_in_scope[$var])) {
$context->vars_in_scope[$var] = $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) { if ((string) $while_context->vars_in_scope[$var] !== (string) $type) {
$context->vars_in_scope[$var] = Type::combineUnionTypes($while_context->vars_in_scope[$var], $type); $context->vars_in_scope[$var] = Type::combineUnionTypes($while_context->vars_in_scope[$var], $type);
}
} }
} }