Skip to content

Commit

Permalink
[Naming] Improve UseImportsResolver to locate inlined Stmt (#2205)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik authored May 1, 2022
1 parent 039181a commit 0298204
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rules/Naming/Naming/UseImportsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Rector\Naming\Naming;

use PhpParser\Node;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\Use_;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
Expand All @@ -30,6 +31,6 @@ public function resolveForNode(Node $node): array
return [];
}

return $this->betterNodeFinder->findInstanceOf($namespace, Use_::class);
return array_filter($namespace->stmts, fn (Stmt $stmt): bool => $stmt instanceof Use_);
}
}

0 comments on commit 0298204

Please sign in to comment.