1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

Merge pull request #6876 from pilif/fix-6875

do not treat __halt_compiler() as an expression being executed
This commit is contained in:
orklah 2021-11-10 12:53:43 +01:00 committed by GitHub
commit a973b23a62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -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(

View File

@ -1093,6 +1093,13 @@ class UnusedCodeTest extends TestCase
$a = new A();
echo $a->getVal(null);',
],
'__halt_compiler_no_usage_check' => [
'<?php
exit(0);
__halt_compiler();
foobar
',
],
];
}