diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/EvalAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/EvalAnalyzer.php index e02ad2c6b..34160e58b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/EvalAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/EvalAnalyzer.php @@ -26,7 +26,10 @@ class EvalAnalyzer PhpParser\Node\Expr\Eval_ $stmt, Context $context ): void { + $was_inside_call = $context->inside_call; + $context->inside_call = true; ExpressionAnalyzer::analyze($statements_analyzer, $stmt->expr, $context); + $context->inside_call = $was_inside_call; $codebase = $statements_analyzer->getCodebase(); diff --git a/tests/UnusedCodeTest.php b/tests/UnusedCodeTest.php index 25a62f712..cf805c26e 100644 --- a/tests/UnusedCodeTest.php +++ b/tests/UnusedCodeTest.php @@ -709,6 +709,10 @@ class UnusedCodeTest extends TestCase return $i; }', ], + 'usedFunctionCallInEval' => [ + 'code' => ' [ 'code' => ' [ + 'code' => ' [ 'code' => '