mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
allow declaring functions and classLikes after a never-returning call
This commit is contained in:
parent
670c740255
commit
33aab6cc40
@ -344,6 +344,10 @@ class StatementsAnalyzer extends SourceAnalyzer
|
|||||||
&& !$context->collect_mutations
|
&& !$context->collect_mutations
|
||||||
&& !($stmt instanceof PhpParser\Node\Stmt\Nop)
|
&& !($stmt instanceof PhpParser\Node\Stmt\Nop)
|
||||||
&& !($stmt instanceof PhpParser\Node\Stmt\InlineHTML)
|
&& !($stmt instanceof PhpParser\Node\Stmt\InlineHTML)
|
||||||
|
&& !($stmt instanceof PhpParser\Node\Stmt\Function_)
|
||||||
|
&& !($stmt instanceof PhpParser\Node\Stmt\Class_)
|
||||||
|
&& !($stmt instanceof PhpParser\Node\Stmt\Interface_)
|
||||||
|
&& !($stmt instanceof PhpParser\Node\Stmt\Trait_)
|
||||||
) {
|
) {
|
||||||
if ($codebase->find_unused_variables) {
|
if ($codebase->find_unused_variables) {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
|
@ -1056,6 +1056,18 @@ class UnusedCodeTest extends TestCase
|
|||||||
`$used`;
|
`$used`;
|
||||||
',
|
',
|
||||||
],
|
],
|
||||||
|
'notUnevaluatedFunction' => [
|
||||||
|
'<?php
|
||||||
|
function neverReturns(): never{
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
unrelated();
|
||||||
|
neverReturns();
|
||||||
|
|
||||||
|
function unrelated(){
|
||||||
|
echo "hello";
|
||||||
|
}',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user