From a042f14fd89f1c25b2c764b1ed8cc40cc08c9ca8 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 8 Apr 2026 17:45:25 +0700 Subject: [PATCH 1/3] Bump to Rector ^2.4.1 and replace deprecated file to getFile() on rector rule --- composer.json | 2 +- src/Rector/StaticCall/RouteActionCallableRector.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 24349c069..9facaf3cd 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "description": "Rector upgrades rules for Laravel Framework", "require": { "php": ">=8.3", - "rector/rector": "^2.3.0", + "rector/rector": "^2.4.1", "webmozart/assert": "^1.11 || ^2.0", "symplify/rule-doc-generator-contracts": "^11.2" }, diff --git a/src/Rector/StaticCall/RouteActionCallableRector.php b/src/Rector/StaticCall/RouteActionCallableRector.php index 2f86b3941..57ce47d59 100644 --- a/src/Rector/StaticCall/RouteActionCallableRector.php +++ b/src/Rector/StaticCall/RouteActionCallableRector.php @@ -243,7 +243,7 @@ private function resolveControllerFromAction(mixed $action, ?string $groupNamesp } [$controller, $method] = $segments; - $namespace = $this->getNamespace($this->file->getFilePath()); + $namespace = $this->getNamespace($this->getFile()->getFilePath()); if ($groupNamespace !== null) { $namespace .= '\\' . $groupNamespace; } From 72228e8bab4be227e7fb29d81d24dff75c7d7ced Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 8 Apr 2026 17:47:42 +0700 Subject: [PATCH 2/3] re-run rector --- rector.php | 1 + src/AbstractRector.php | 2 ++ src/NodeAnalyzer/FacadeAssertionAnalyzer.php | 2 ++ src/NodeAnalyzer/RelationshipAnalyzer.php | 2 ++ src/NodeFactory/DispatchableTestsMethodsFactory.php | 2 ++ src/Rector/FuncCall/TypeHintTappableCallRector.php | 2 -- src/Rector/If_/AbortIfRector.php | 1 - src/Rector/If_/ReportIfRector.php | 1 - src/Rector/StaticCall/CarbonSetTestNowToTravelToRector.php | 2 ++ src/Set/LaravelSetProvider.php | 2 ++ src/Set/Packages/Faker/FakerSetList.php | 2 ++ src/Set/Packages/Livewire/LivewireSetList.php | 2 ++ src/ValueObject/ApplyDefaultInsteadOfNullCoalesce.php | 2 ++ src/ValueObject/ExpectedClassMethodMethodCalls.php | 2 ++ src/ValueObject/ForwardingCall.php | 2 ++ src/ValueObject/ReplaceRequestKeyAndMethodValue.php | 2 ++ src/ValueObject/ReplaceServiceContainerCallArg.php | 2 ++ .../DispatchToHelperFunctionsRectorTest.php | 2 ++ 18 files changed, 29 insertions(+), 4 deletions(-) diff --git a/rector.php b/rector.php index ef24bafb4..6b538c6b3 100644 --- a/rector.php +++ b/rector.php @@ -16,6 +16,7 @@ // for tests '*/Source/*', '*/Fixture/*', + '*/tests/NodeAnalyzer/fixtures/*', // skip for handle scoped, like in the rector-src as well // @see https://github.com/rectorphp/rector-src/blob/7f73cf017214257c170d34db3af7283eaeeab657/rector.php#L71 diff --git a/src/AbstractRector.php b/src/AbstractRector.php index 6819f0795..2c7a6b264 100644 --- a/src/AbstractRector.php +++ b/src/AbstractRector.php @@ -1,5 +1,7 @@ getArgs()[1]->value; if ($closure->getParams() === []) { @@ -114,7 +113,6 @@ private function refactorMethodCall(MethodCall $methodCall): ?MethodCall return null; } - /** @var Closure $closure */ $closure = $methodCall->getArgs()[0]->value; if ($closure->getParams() === []) { diff --git a/src/Rector/If_/AbortIfRector.php b/src/Rector/If_/AbortIfRector.php index a136a9dd6..9be140f86 100644 --- a/src/Rector/If_/AbortIfRector.php +++ b/src/Rector/If_/AbortIfRector.php @@ -71,7 +71,6 @@ public function refactor(Node $node): ?Node $this->isName($ifStmts[0]->expr, 'abort') ) { $condition = $node->cond; - /** @var FuncCall $abortCall */ $abortCall = $ifStmts[0]->expr; if ($this->exceptionUsesVariablesAssignedByCondition($abortCall, $condition)) { diff --git a/src/Rector/If_/ReportIfRector.php b/src/Rector/If_/ReportIfRector.php index cca7035ab..c339a9d7d 100644 --- a/src/Rector/If_/ReportIfRector.php +++ b/src/Rector/If_/ReportIfRector.php @@ -71,7 +71,6 @@ public function refactor(Node $node): ?Node $this->isName($ifStmts[0]->expr, 'report') ) { $condition = $node->cond; - /** @var FuncCall $abortCall */ $abortCall = $ifStmts[0]->expr; if ($this->exceptionUsesVariablesAssignedByCondition($abortCall, $condition)) { diff --git a/src/Rector/StaticCall/CarbonSetTestNowToTravelToRector.php b/src/Rector/StaticCall/CarbonSetTestNowToTravelToRector.php index edb35a977..a9742b4ac 100644 --- a/src/Rector/StaticCall/CarbonSetTestNowToTravelToRector.php +++ b/src/Rector/StaticCall/CarbonSetTestNowToTravelToRector.php @@ -1,5 +1,7 @@ Date: Wed, 8 Apr 2026 17:48:54 +0700 Subject: [PATCH 3/3] re-run rector --- src/Rector/If_/AbortIfRector.php | 2 ++ src/Rector/If_/ReportIfRector.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Rector/If_/AbortIfRector.php b/src/Rector/If_/AbortIfRector.php index 9be140f86..49a39d732 100644 --- a/src/Rector/If_/AbortIfRector.php +++ b/src/Rector/If_/AbortIfRector.php @@ -1,5 +1,7 @@