mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
[DeadCode] Fix RemoveUnreachableStatementRector issue with global function declarations (#5575)
This commit is contained in:
parent
5921571647
commit
a3f3b0e7d2
@ -12,6 +12,7 @@ use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Else_;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use PhpParser\Node\Stmt\Nop;
|
||||
@ -174,6 +175,10 @@ CODE_SAMPLE
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($stmt instanceof Function_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($stmt instanceof Namespace_) {
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\DeadCode\Tests\Rector\Stmt\RemoveUnreachableStatementRector\Fixture;
|
||||
|
||||
calledFunction();
|
||||
return;
|
||||
|
||||
function calledFunction()
|
||||
{
|
||||
define("SOMETHING",true);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user