mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
do not treat __halt_compiler() as an expression being executed
this fixes #6875
This commit is contained in:
parent
a193ec4573
commit
f407ac846a
@ -348,6 +348,7 @@ class StatementsAnalyzer extends SourceAnalyzer
|
|||||||
&& !($stmt instanceof PhpParser\Node\Stmt\Class_)
|
&& !($stmt instanceof PhpParser\Node\Stmt\Class_)
|
||||||
&& !($stmt instanceof PhpParser\Node\Stmt\Interface_)
|
&& !($stmt instanceof PhpParser\Node\Stmt\Interface_)
|
||||||
&& !($stmt instanceof PhpParser\Node\Stmt\Trait_)
|
&& !($stmt instanceof PhpParser\Node\Stmt\Trait_)
|
||||||
|
&& !($stmt instanceof PhpParser\Node\Stmt\HaltCompiler)
|
||||||
) {
|
) {
|
||||||
if ($codebase->find_unused_variables) {
|
if ($codebase->find_unused_variables) {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
|
@ -1093,6 +1093,13 @@ class UnusedCodeTest extends TestCase
|
|||||||
$a = new A();
|
$a = new A();
|
||||||
echo $a->getVal(null);',
|
echo $a->getVal(null);',
|
||||||
],
|
],
|
||||||
|
'__halt_compiler_no_usage_check' => [
|
||||||
|
'<?php
|
||||||
|
exit(0);
|
||||||
|
__halt_compiler();
|
||||||
|
foobar
|
||||||
|
',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user