1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Only update inner loop vars that have changed given preconditions

This commit is contained in:
Matt Brown 2017-12-11 12:03:50 -05:00
parent 301e393e37
commit 51a2f12bbf

View File

@ -339,18 +339,14 @@ class LoopChecker
$statements_checker->getSuppressedIssues()
);
if ($vars_in_scope_reconciled === false) {
return false;
}
foreach ($loop_scope->loop_parent_context->vars_in_scope as $var_id => $type) {
if (isset($vars_in_scope_reconciled[$var_id])) {
foreach ($changed_var_ids as $var_id) {
if (isset($vars_in_scope_reconciled[$var_id])
&& isset($loop_scope->loop_parent_context->vars_in_scope[$var_id])
) {
$loop_scope->loop_parent_context->vars_in_scope[$var_id] = $vars_in_scope_reconciled[$var_id];
}
}
foreach ($changed_var_ids as $changed_var_id) {
$loop_scope->loop_parent_context->removeVarFromConflictingClauses($changed_var_id);
$loop_scope->loop_parent_context->removeVarFromConflictingClauses($var_id);
}
}
}