From 45326b0d64c8003172e8985ac8a183351d770d2c Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Sat, 17 Oct 2020 18:44:42 -0400 Subject: [PATCH] Prevent unnecessary assignments --- src/Psalm/Internal/Analyzer/Statements/Block/IfAnalyzer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfAnalyzer.php index 09435836246..66defdc7ab1 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfAnalyzer.php @@ -665,10 +665,10 @@ function (Clause $c) use ($changed_var_ids): bool { if ($internally_applied_if_cond_expr !== $cond || $externally_applied_if_cond_expr !== $cond ) { - $assigned_var_ids = $outer_context->assigned_var_ids; + $assigned_var_ids = $first_cond_assigned_var_ids; $if_conditional_context->assigned_var_ids = []; - $referenced_var_ids = $outer_context->referenced_var_ids; + $referenced_var_ids = $first_cond_referenced_var_ids; $if_conditional_context->referenced_var_ids = []; $if_conditional_context->inside_conditional = true;