Skip to content

Commit 862d98e

Browse files
committed
[ci-review] Rector Rectify
1 parent 241920f commit 862d98e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/Bridge/PhpParser/NodeClassFinder.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Rector\Bridge\PhpParser;
66

7+
use PhpParser\Node;
78
use Nette\Loaders\RobotLoader;
89
use PHPStan\Node\AnonymousClassNode;
910
use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace;
@@ -12,7 +13,7 @@
1213
final class NodeClassFinder
1314
{
1415
/**
15-
* @return array<class-string<\PhpParser\Node>>
16+
* @return array<class-string<Node>>
1617
*/
1718
public static function find(): array
1819
{
@@ -29,12 +30,12 @@ public static function find(): array
2930
$nodeClasses = array_keys($robotLoader->getIndexedClasses());
3031

3132
$instantiableNodeClasses = array_filter($nodeClasses, function (string $nodeClass): bool {
32-
$nodeClassReflection = new ReflectionClass($nodeClass);
33-
if ($nodeClassReflection->isAbstract()) {
33+
$reflectionClass = new ReflectionClass($nodeClass);
34+
if ($reflectionClass->isAbstract()) {
3435
return false;
3536
}
3637

37-
return ! $nodeClassReflection->isInterface();
38+
return ! $reflectionClass->isInterface();
3839
});
3940

4041
// this is needed, as PHPStan replaces the Class_ node of anonymous class completely

src/PhpParser/NodeTraverser/RectorNodeTraverser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Rector\PhpParser\NodeTraverser;
66

7+
use Rector\Bridge\PhpParser\NodeClassFinder;
78
use PhpParser\Node;
89
use PhpParser\Node\Stmt;
910
use PhpParser\NodeVisitor;
@@ -88,7 +89,7 @@ private function prepareNodeVisitors(): void
8889
// 2. iterate through them
8990
/** @var RectorInterface $visitor */
9091
foreach ($this->visitors as $visitor) {
91-
foreach (\Rector\Bridge\PhpParser\NodeClassFinder::find() as $nodeClass) {
92+
foreach (NodeClassFinder::find() as $nodeClass) {
9293
foreach ($visitor->getNodeTypes() as $matchingNodeType) {
9394
if (is_a($nodeClass, $matchingNodeType, true)) {
9495
$this->visitorsPerNodeClass[$nodeClass][] = $visitor;

0 commit comments

Comments
 (0)