diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php index 4696bb991..0d09faff6 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php @@ -149,7 +149,7 @@ class IfConditionalAnalyzer // we need to clone the current context so our ongoing updates // to $outer_context don't mess with elseif/else blocks - $original_context = clone $outer_context; + $post_if_context = clone $outer_context; if ($internally_applied_if_cond_expr !== $cond || $externally_applied_if_cond_expr !== $cond @@ -275,7 +275,7 @@ class IfConditionalAnalyzer return new \Psalm\Internal\Scope\IfConditionalScope( $if_context, - $original_context, + $post_if_context, $cond_referenced_var_ids, $assigned_in_conditional_var_ids, $entry_clauses diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php index f710ab9e7..56b02458a 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php @@ -252,12 +252,12 @@ class IfAnalyzer ) : bool { // If we're assigning inside if ($if_conditional_scope->assigned_in_conditional_var_ids - && $if_scope->mic_drop_context + && $if_scope->post_leaving_if_context ) { self::addConditionallyAssignedVarsToContext( $statements_analyzer, $cond, - $if_scope->mic_drop_context, + $if_scope->post_leaving_if_context, $outer_context, $if_conditional_scope->assigned_in_conditional_var_ids ); @@ -340,7 +340,7 @@ class IfAnalyzer public static function addConditionallyAssignedVarsToContext( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr $cond, - Context $mic_drop_context, + Context $post_leaving_if_context, Context $outer_context, array $assigned_in_conditional_var_ids ) : void { @@ -381,15 +381,15 @@ class IfAnalyzer $expr->getAttributes() ); - $mic_drop_context->inside_negation = !$mic_drop_context->inside_negation; + $post_leaving_if_context->inside_negation = !$post_leaving_if_context->inside_negation; ExpressionAnalyzer::analyze( $statements_analyzer, $fake_negated_expr, - $mic_drop_context + $post_leaving_if_context ); - $mic_drop_context->inside_negation = !$mic_drop_context->inside_negation; + $post_leaving_if_context->inside_negation = !$post_leaving_if_context->inside_negation; } IssueBuffer::clearRecordingLevel(); @@ -398,8 +398,8 @@ class IfAnalyzer $statements_analyzer->node_data = $old_node_data; foreach ($assigned_in_conditional_var_ids as $var_id => $_) { - if (isset($mic_drop_context->vars_in_scope[$var_id])) { - $outer_context->vars_in_scope[$var_id] = clone $mic_drop_context->vars_in_scope[$var_id]; + if (isset($post_leaving_if_context->vars_in_scope[$var_id])) { + $outer_context->vars_in_scope[$var_id] = clone $post_leaving_if_context->vars_in_scope[$var_id]; } } } diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php index 668e964a8..b20134fcb 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php @@ -84,7 +84,7 @@ class IfElseAnalyzer || (count($final_actions) && !in_array(ScopeAnalyzer::ACTION_NONE, $final_actions, true)); if ($has_leaving_statements) { - $if_scope->mic_drop_context = clone $context; + $if_scope->post_leaving_if_context = clone $context; } } @@ -100,7 +100,7 @@ class IfElseAnalyzer $if_context = $if_conditional_scope->if_context; - $original_context = $if_conditional_scope->original_context; + $post_if_context = $if_conditional_scope->post_if_context; $cond_referenced_var_ids = $if_conditional_scope->cond_referenced_var_ids; $assigned_in_conditional_var_ids = $if_conditional_scope->assigned_in_conditional_var_ids; } catch (\Psalm\Exception\ScopeAnalysisException $e) { @@ -319,7 +319,7 @@ class IfElseAnalyzer $context->referenced_var_ids ); - $temp_else_context = clone $original_context; + $temp_else_context = clone $post_if_context; $changed_var_ids = []; @@ -368,7 +368,7 @@ class IfElseAnalyzer } // check the else - $else_context = clone $original_context; + $else_context = clone $post_if_context; // check the elseifs foreach ($stmt->elseifs as $elseif) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php index 48ba512a8..86e8f078e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php @@ -53,7 +53,7 @@ class OrAnalyzer $codebase = $statements_analyzer->getCodebase(); - $mic_drop_context = null; + $post_leaving_if_context = null; if (!$stmt->left instanceof PhpParser\Node\Expr\BinaryOp\BooleanOr || !$stmt->left->left instanceof PhpParser\Node\Expr\BinaryOp\BooleanOr @@ -77,7 +77,7 @@ class OrAnalyzer $left_assigned_var_ids = $if_conditional_scope->assigned_in_conditional_var_ids; if ($stmt->left instanceof PhpParser\Node\Expr\BinaryOp\BooleanOr) { - $mic_drop_context = clone $context; + $post_leaving_if_context = clone $context; } } catch (\Psalm\Exception\ScopeAnalysisException $e) { return false; @@ -88,7 +88,7 @@ class OrAnalyzer $pre_assigned_var_ids = $context->assigned_var_ids; - $mic_drop_context = clone $context; + $post_leaving_if_context = clone $context; $left_context = clone $context; $left_context->parent_context = $context; @@ -193,12 +193,12 @@ class OrAnalyzer if ($stmt->left instanceof PhpParser\Node\Expr\BinaryOp\BooleanOr && $left_assigned_var_ids - && $mic_drop_context + && $post_leaving_if_context ) { IfAnalyzer::addConditionallyAssignedVarsToContext( $statements_analyzer, $stmt->left, - $mic_drop_context, + $post_leaving_if_context, $right_context, $left_assigned_var_ids ); diff --git a/src/Psalm/Internal/Scope/IfConditionalScope.php b/src/Psalm/Internal/Scope/IfConditionalScope.php index 39459dbb6..a6791a065 100644 --- a/src/Psalm/Internal/Scope/IfConditionalScope.php +++ b/src/Psalm/Internal/Scope/IfConditionalScope.php @@ -10,7 +10,7 @@ class IfConditionalScope { public $if_context; - public $original_context; + public $post_if_context; /** * @var array @@ -32,13 +32,13 @@ class IfConditionalScope */ public function __construct( Context $if_context, - Context $original_context, + Context $post_if_context, array $cond_referenced_var_ids, array $assigned_in_conditional_var_ids, array $entry_clauses ) { $this->if_context = $if_context; - $this->original_context = $original_context; + $this->post_if_context = $post_if_context; $this->cond_referenced_var_ids = $cond_referenced_var_ids; $this->assigned_in_conditional_var_ids = $assigned_in_conditional_var_ids; $this->entry_clauses = $entry_clauses; diff --git a/src/Psalm/Internal/Scope/IfScope.php b/src/Psalm/Internal/Scope/IfScope.php index 9c9034002..98ee90741 100644 --- a/src/Psalm/Internal/Scope/IfScope.php +++ b/src/Psalm/Internal/Scope/IfScope.php @@ -88,5 +88,5 @@ class IfScope /** * @var ?\Psalm\Context */ - public $mic_drop_context; + public $post_leaving_if_context; }