diff --git a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php index 2e7dedee3..2c3943bfb 100644 --- a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php @@ -348,6 +348,7 @@ class StatementsAnalyzer extends SourceAnalyzer && !($stmt instanceof PhpParser\Node\Stmt\Class_) && !($stmt instanceof PhpParser\Node\Stmt\Interface_) && !($stmt instanceof PhpParser\Node\Stmt\Trait_) + && !($stmt instanceof PhpParser\Node\Stmt\HaltCompiler) ) { if ($codebase->find_unused_variables) { if (IssueBuffer::accepts( diff --git a/tests/UnusedCodeTest.php b/tests/UnusedCodeTest.php index e7367ed41..52f12e174 100644 --- a/tests/UnusedCodeTest.php +++ b/tests/UnusedCodeTest.php @@ -1093,6 +1093,13 @@ class UnusedCodeTest extends TestCase $a = new A(); echo $a->getVal(null);', ], + '__halt_compiler_no_usage_check' => [ + '