diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php index b24f3e832..b7a8043a4 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php @@ -134,7 +134,8 @@ class AndAnalyzer $statements_analyzer, [], $context->inside_loop, - new CodeLocation($statements_analyzer->getSource(), $stmt->left) + new CodeLocation($statements_analyzer->getSource(), $stmt->left), + $context->inside_negation ); $right_context->vars_in_scope = $right_vars_in_scope; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php index a54c7eb69..0ca5514cb 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php @@ -189,7 +189,7 @@ class OrAnalyzer [], $left_context->inside_loop, new CodeLocation($statements_analyzer->getSource(), $stmt->left), - true + !$context->inside_negation ); $right_context->vars_in_scope = $right_vars_in_scope; } @@ -270,7 +270,8 @@ class OrAnalyzer $statements_analyzer, [], $left_context->inside_loop, - new CodeLocation($statements_analyzer->getSource(), $stmt->right) + new CodeLocation($statements_analyzer->getSource(), $stmt->right), + $context->inside_negation ); }