Skip to content

Commit 62c952c

Browse files
authored
Merge pull request #9854 from samsonasik/chore-prepare-for-rector-230
chore: Bump to rector 2.3.0 and migrate FileWithoutNamespace to FileNode
2 parents e56ba93 + 4b4b3c6 commit 62c952c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"phpunit/phpcov": "^9.0.2 || ^10.0",
2929
"phpunit/phpunit": "^10.5.16 || ^11.2",
3030
"predis/predis": "^3.0",
31-
"rector/rector": "2.2.14",
31+
"rector/rector": "2.3.0",
3232
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
3333
},
3434
"replace": {

utils/src/Rector/UnderscoreToCamelCaseVariableNameRector.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use PhpParser\Node\Stmt\Namespace_;
2424
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
2525
use Rector\Php\ReservedKeywordAnalyzer;
26-
use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace;
26+
use Rector\PhpParser\Node\FileNode;
2727
use Rector\Rector\AbstractRector;
2828
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
2929
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@@ -77,14 +77,19 @@ public function run($aB)
7777
*/
7878
public function getNodeTypes(): array
7979
{
80-
return [FileWithoutNamespace::class, Namespace_::class];
80+
return [FileNode::class, Namespace_::class];
8181
}
8282

8383
/**
84-
* @param ClassMethod|Closure|FileWithoutNamespace|Function_|Namespace_ $node
84+
* @param FileNode|Namespace_ $node
8585
*/
8686
public function refactor(Node $node): ?Node
8787
{
88+
if ($node instanceof FileNode && $node->isNamespaced()) {
89+
// handled in Namespace_ node
90+
return null;
91+
}
92+
8893
if ($node->stmts === null) {
8994
return null;
9095
}

0 commit comments

Comments
 (0)