Skip to content

chore(deps): update dependency rector/rector to ^2.5.9 - #824

Open
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/rector-rector-2.x
Open

chore(deps): update dependency rector/rector to ^2.5.9#824
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/rector-rector-2.x

Conversation

@renovate

@renovate renovate Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

ℹ️ Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Confidence
rector/rector (source) ^2.4.2^2.5.9 age confidence

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

rectorphp/rector (rector/rector)

v2.5.9: Released Rector 2.5.9

Compare Source

Bugfixes 🐛

  • [DeadCode] Remove unreachable class-like checks in Class_-only rules (#​8217)
  • [CodingStyle] Use native php-parser node API over class reflection (#​8218)
  • [Php80] Remove AstResolver usage on AddParamBasedOnParentClassMethodRector (#​8196)
  • Wire RichParser node visitors via DI factory instead of private property hack (#​8215)
  • [Php80] Skip promoting a property the parent declares without a native type in ClassPropertyAssignToConstructorPromotionRector (#​8232)
  • [DeadCode] Keep empty __construct() in anonymous class that extends parent on RemoveEmptyClassMethodRector (#​8219)
  • [DeadCode] Skip negative zero on RemoveDeadZeroAndOneOperationRector (#​8213)
  • [DeadCode] Skip protected property on non-final class on RemoveDefaultValueFromAssignedPropertyRector (#​8214)
  • [DeadCode] Skip array dim fetch assign on RemoveDefaultValueFromAssignedPropertyRector (#​8212)
  • [DeadCode] Skip if/else in loop on RemoveDefaultValueFromAssignedPropertyRector (#​8211)
  • [DeadCode] Skip early return in constructor on RemoveDefaultValueFromAssignedPropertyRector (#​8209)

Set changes 🗑️

NullToStrictStringFuncCallArgRector out of the PHP 8.1 set (#​8234)

The rule and all its fixtures stay, so it can still be opted into:

->withRules([NullToStrictStringFuncCallArgRector::class])

Deprecations 💀

TypeDeclarationDocblocks: 3 data provider docblock rules (#​8235)

Data provider docblock typing is not relevant to code quality — it increases maintenance cost and decreases readability of the test class.

Deprecated rules:

  • AddReturnArrayDocblockFromDataProviderParamRector
  • AddReturnDocblockDataProviderRector
  • AddParamArrayDocblockFromDataProviderRector

rectorphp/rector-symfony 🎵

  • [Symfony72] Match push() to its own RequestStack variable in PushRequestToRequestStackConstructorRector (#​971)
  • [Symfony44] Skip custom isGranted() service calls in controllers in AuthorizationCheckerIsGrantedExtractorRector (#​973)
  • [Symfony42] Update Cookie fixture after NewToStaticCallRector config removal (#​974)
  • Drop rector/type-perfect, its rules ship in tomasvotruba/type-coverage 2.3 now (#​972)
  • Bump dev dependencies, PHPUnit 13 (#​976)
  • [deps] Bump symfony/config to ^8.1 (#​977)
Deprecated: SimplifyFormRenderingRector (#​975)

The rule removed the explicit ->createView() call when a form was passed to render():

Symfony supports passing the FormInterface directly, but the shorthand is ambiguous and breaks dynamic forms: forms modified in PRE_SET_DATA/POST_SUBMIT listeners and submitted over AJAX end up with a 422 response and no clear error. Keeping the explicit ->createView() call is the reliable form. See symfony/symfony#50542.


rectorphp/rector-phpunit 🧪

  • [PHPUnit 13] Fix class in expectExceptionMessage() rename to TestCase (#​735)

rectorphp/rector-downgrade-php ⬇️

  • [DowngradePhp81] Reference MHASH_* constants by name in DowngradeHashAlgorithmXxHashRector to fix PHP 8.5 deprecation (#​386)

v2.5.8: Released Rector 2.5.8

Compare Source

New Features 🥳

  • [dx] Add "if" set with if/else/ternary rules (#​8199)
  • [DeadCode] Add RemoveDeadInstanceOfAssertRector (#​8202)
  • [DeadCode] Add RemoveDoubleSelfAssignRector (#​8203)
  • [DeadCode] Add RemoveParentDelegatingClassMethodRector (#​8204)
  • [DeadCode] Add RemoveDefaultValueFromAssignedPropertyRector (#​8207)
  • [TypeDeclaration] Fix incomplete type on yield variable + yield from in AddParamTypeBasedOnPHPUnitDataProviderRector (#​8206)

Bugfixes 🐛

  • Fix LogicalToBooleanRector: parenthesize assignments nested under unary/binary operators (#​8184)
  • [TypeDeclaration] Skip trait methods on ParamTypeByMethodCallType rules (#​8189)
  • [Php80] Skip promotion when property type is wider than constructor param on ClassPropertyAssignToConstructorPromotionRector (#​8170), Thanks @​ximki-vinki!
  • [Php85] Skip outer spread on NestedFuncCallsToPipeOperatorRector (#​8191)
  • [DeadCode] Fix crash on float version arg in ConditionResolver (#​8192)
  • Make NestedFuncCallsToPipeOperatorRector minimum depth configurable (#​8193)
  • Fix codeception data provider detection (#​8194), Thanks @​d-mitrofanov-v!
  • Make PHPStan DI-Container available in bootstrap files (#​8190), Thanks @​staabm!
  • [Privatization] Skip Symfony Command protected static property in PrivatizeFinalClassPropertyRector (#​8201)
  • Bump to PHPStan ^2.2.6 and Fix its Container compatibility in RichParser (#​8208)

Removed 💀

  • skip @​ return this on RemoveReturnTagIncompatibleWithNativeTypeRector on Traits (#​8185)
  • [DeadCode] Skip string scalar sub type on RemoveReturnTagIncompatibleWithNativeTypeRector (#​8186)

rectorphp/rector-symfony 🎵

  • [Symfony73] Remove empty configure() method in CommandHelpToAttributeRector (#​969)
  • [Symfony73] Keep AbstractExtension when Twig extension overrides a built-in function/filter (#​968)
  • [Symfony73] Wrap scalar groups option in array in ConstraintOptionsToNamedArgumentsRector (#​967)
  • [Symfony61] Remove empty configure() method even with empty body (#​966)
  • [Symfony61] Remove now empty configure() method in CommandConfigureToAttributeRector (#​965)
  • [CodeQuality] Respect typeGuardedClasses and skip closure-only returns in ResponseReturnTypeControllerActionRector (#​964)
  • [Symfony44] Return 1 instead of (int) false in ConsoleExecuteReturnIntRector (#​963)
  • [CodeQuality] Add union and method call return type support to ResponseReturnTypeControllerActionRector (#​961)
  • [Twig30] Add new set for Twig 30 (#​960), Thanks @​MrYamous

rectorphp/rector-doctrine 🟠


rectorphp/rector-phpunit 🟢

  • [PHPUnit 13] Add PHPUnit 13 config set (#​733)
  • [CodeQuality] Skip super global variables on AssertIssetToSpecificMethodRector (#​732)
  • [CodeQuality] Skip anonymous classes in AssertClassToThisAssertRector (#​729)
  • [CodeQuality] Move AssertClassToThisAssertRector hook from Class_ to ClassMethod (#​728)
  • AssertEqualsToSameRector: skip arrays whose actual value key order is not provably identical (#​727)

v2.5.7: Released Rector 2.5.7

Compare Source

This release sharpens the PHPUnit code-quality sets, adds a focused narrow asserts set, deprecates two blurry Symfony web-test rules, and fixes a handful of docblock false-positives in dead-code removal.

New Features 🎉

PHPUnit: PHPUNIT_NARROW_ASSERTS set

A new set focused on narrowing broad asserts to their specific, more descriptive method — e.g. assertTrue(isset($a['b']))assertArrayHasKey('b', $a). (rector-phpunit #​716)

use Rector\PHPUnit\Set\PHPUnitSetList;

return RectorConfig::configure()
    ->withSets([PHPUnitSetList::PHPUNIT_NARROW_ASSERTS]);

withPreparedSets() gains phpunitNarrowAsserts + phpunitMockToStub

The 2 PHPUnit sets are now toggleable like any other prepared set. (#​8178)

return RectorConfig::configure()
    ->withPreparedSets(
        phpunitNarrowAsserts: true,
        phpunitMockToStub: true,
    );

PHPUnit: flip with($this->callback(...)) on void methods to willReturnCallback()

VoidMethodWithCallbackToWillReturnCallbackRector (renamed + refocused) drops the pointless return value and types the closure as void, matching the mocked void method. (rector-phpunit #​724)

 $this->createMock(SomeClass::class)
     ->method('run')
-    ->with($this->callback(function ($arg) {
-        echo $arg;
-
-        return true;
-    }));
+    ->willReturnCallback(function ($arg): void {
+        echo $arg;
+    });
Console: -v as alias for --version

Since the verbose option was removed, -v now prints the version. (#​8177)

vendor/bin/rector -v

# Rector 2.x.x

Improvements 🔧

  • [StaticTypeMapper] Map phpstan-special scalar types (literal-string, numeric-string, …) to their real PHPStan types instead of a bogus ObjectType, so precise docblocks survive dead-code cleanup (#​8176)
  • [PHPUnit CodeQuality] Verify assert method name exists on the Assert class via reflection before transforming (rector-phpunit #​720)
  • [PHPUnit CodeQuality] Simplify single-statement void callback in CallbackSingleAssertToSimplerRector (rector-phpunit #​722)
  • [PHPUnit CodeQuality] Collapse all instanceof asserts for multiple nullable instances in a single run (rector-phpunit #​721)
  • [PHPUnit CodeQuality] Use atLeast() instead of exactly() in DecorateWillReturnMapWithExpectsMockRector (rector-phpunit #​719)

Bug Fixes 🐛

  • [DeadCode] Preserve generic @return tags in RemoveReturnTagIncompatibleWithNativeTypeRector (#​8183)
  • [DeadCode] Skip templated type in RemoveReturnTagIncompatibleWithNativeTypeRector (#​8180)
  • [DeadCode] Skip PHPStan type alias in RemoveReturnTagIncompatibleWithNativeTypeRector (#​8179)
  • [CodeQuality] Skip abstract class in CompleteDynamicPropertiesRector (#​8182)
  • [Php71] Skip magic @method in RemoveExtraParametersRector (#​8181)
  • [PHPUnit] Skip with() multiple arguments in VoidMethodWithCallbackToWillReturnCallbackRector (rector-phpunit #​725)
  • [PHPUnit] Skip new object instances in NarrowIdenticalWithConsecutiveRector — each new is a fresh instance, collapsing them changes intent (rector-phpunit #​726)
  • [PHPUnit] Skip mock property removal when used in a trait (rector-phpunit #​723)
  • [PHPUnit] Skip nested value compare in CallbackSingleAssertToSimplerRector (rector-phpunit #​718)
  • [PHPUnit] Skip union types in AssertEqualsToSameRector to preserve loose comparison (rector-phpunit #​717)

Deprecations 💀

Symfony: WebTestCaseAssertIsSuccessfulRector + WebTestCaseAssertResponseCodeRector

Both rules hide the asserted behavior and force a different assert method per status code, splitting one clear assertion into several implicit ones. Asserting the HTTP status code directly is clearer and uniform. (rector-symfony #​958)


v2.5.6: Released Rector 2.5.6

Compare Source

New Features 🥳

  • [DeadCode] Add RemoveReturnTagIncompatibleWithNativeTypeRector (#​8172)
 final class SomeClass
 {
-    /**
-     * @​return SomeObject
-     */
     public function getName(): string
     {
         return $this->someObject->getName();
     }
 }
  • [TypeDeclarationDocblocks] Add MergePhpstanDocTagIntoNativeRector to merge @phpstan-* doc tags into native tags (#​8171)
 final class SomeClass
 {
     /**
-     * @​var Collection
-     *
-     * @&#8203;phpstan-var Collection<int, string>
+     * @&#8203;var Collection<int, string>
      */
     private $items;
 }

Bugfixes 🐛


PHPUnit 🧪

New rules and changes from rector-phpunit.

New Rules
  • [CodeQuality] Add AssertClassToThisAssertRector (#​707)
 use PHPUnit\Framework\Assert;
 use PHPUnit\Framework\TestCase;

 final class SomeClass extends TestCase
 {
     public function run()
     {
-        Assert::assertEquals('expected', $result);
+        $this->assertEquals('expected', $result);
     }
 }
  • [CodeQuality] Add BareCreateMockAssignToDirectUseRector — inline a single-use createMock() assignment (#​708)
 final class SomeTest extends TestCase
 {
     public function test()
     {
-        $someObject = $this->createMock(SomeClass::class);
-        $this->process($someObject);
+        $this->process($this->createMock(SomeClass::class));
     }

     private function process(SomeClass $someObject): void
     {
     }
 }
  • [CodeQuality] Add WillReturnCallbackFallbackToThrowRector — throw on an unexpected extra consecutive call (#​710)
         $this->someServiceMock->expects($matcher)
             ->method('run')
             ->willReturnCallback(function () use ($matcher) {
                 if ($matcher->numberOfInvocations() === 1) {
                     return 1;
                 }
+
+                throw new \PHPUnit\Framework\Exception(sprintf('Method should not be called for the %dth time', $matcher->numberOfInvocations()));
             });
  • [CodeQuality] Add RemoveReturnFromVoidMethodMockCallbackRector — type a void mock callback and drop its value return (#​711)
         $this->createMock(SomeClass::class)
             ->method('run')
-            ->willReturnCallback(function ($arg) {
+            ->willReturnCallback(function ($arg): void {
                 echo $arg;
-
-                return true;
             });

(SomeClass::run() returns void.)

  • [CodeQuality] Add CallbackSingleAssertToSimplerRector — collapse a with() callback with a sole assertSame() to equalTo() (#​714)
         $builder->expects($this->exactly(2))
             ->method('add')
-            ->with($this->callback(function ($type): bool {
-                $this->assertSame(TextType::class, $type);
-
-                return true;
-            }));
+            ->with($this->equalTo(TextType::class));
Improvements
  • [CodeQuality] Skip TestCase suffix classes in RemoveNeverUsedMockPropertyRector (#​709)
  • [CodeQuality] Produce void callbacks with bare return in WithCallbackIdenticalToStandaloneAssertsRector (#​712)
  • [CodeQuality] Handle return throw and return null in void mock callbacks (#​713)

v2.5.5: Released Rector 2.5.5

Compare Source

New Features 🥳

  • [CodingStyle] Add AlternativeIfToBracketRector (#​8158)
  • [TypeDeclaration] Add PrivateMethodReturnTypeFromStrictNewArrayRector, split private methods out (#​8153)
  • [CodeQuality] Decopule array and object variants from ExplicitBoolCompareRector (#​8162)

Bugfixes 🐛

  • [TypeDeclaration] Fix AddClosureParamTypeForArrayMapRector to type closure params from array values, not keys (#​8163)
  • [Php56] Add missing parentheses for lower-precedence operands in PowToExpRector (#​8161)
  • [Php80] Keep trailing doc comment after annotation in AnnotationToAttributeRector (#​8160)
  • [CodeQuality] Skip same boolean in both branches in SimplifyIfReturnBoolRector (#​8159)
  • [CodeQuality] Skip alternative syntax (if/endif) in ShortenElseIfRector (#​8157)
  • [EarlyReturn] Split nested && operand into its own early return in ReturnBinaryOrToEarlyReturnRector (#​8156)
  • [CodeQuality] Preserve parentheses around low-precedence operands in LogicalToBooleanRector (#​8155)
  • [CodeQuality] Skip inner function referenced as string callable in InnerFunctionToPrivateMethodRector (#​8154)
  • [CodeQuality] Preserve parentheses around right-side assign in LogicalToBooleanRector (#​8152)
  • [CodeQuality] Wrap assign on right side of binary op in parentheses in LogicalToBooleanRector (#​8151)
  • [DeadCode] Keep generic static union docblock in RemoveDuplicatedReturnSelfDocblockRector (#​8150)

v2.5.4: Released Rector 2.5.4

Compare Source

New Features 🥳

  • [TypeDeclaration] Add ReturnTypeFromGetRepositoryDocblockRector (#​8146)

Bugfixes 🐛

  • [DeadCode] Keep generic @​ var/@​ return self<...> narrowing annotations (#​8147)
  • [TypeDeclaration] Handle getRepository() return via local variable in ReturnTypeFromGetRepositoryDocblockRector (#​8148)

v2.5.3: Released Rector 2.5.3

Compare Source

New Features 🥳

withTypeGuardedClasses()

Are you an open-source project or package used by others? Do you want to make type changes, but keep BC?

Guard the listed classes and their non-final descendants against method signature changes - e.g. adding a return type or a param type — that would break child classes (#​8135)

return RectorConfig::configure()
    ->withTypeGuardedClasses([SomeContract::class]);

New Rules 🎉

NegatedAndsToPositiveOrsRector

(CodeQuality) — simplify a negated "and" to "or" via de Morgan (#​8082)

 $a = 5;
 $b = 10;
-$result = !($a > 20 && $b <= 50);
+$result = $a <= 20 || $b > 50;

ExplicitAttributeNamedArgsRector

(CodeQuality) — positional attribute args → named args (#​8079), Thanks @​DaveLiddament!

-#[SomeAttribute(SomeClass::class, null, ['home'])]
+#[SomeAttribute(value: SomeClass::class, only: null, except: ['home'])]
 class SomeClass
 {
 }

SwitchTrueToMatchRector

(CodeQuality) — switch (true) of returning cases → match (true), replaces deprecated SwitchTrueToIfRector (#​8113)

-        switch (true) {
-            case $value === 0:
-                return 'no';
-            case $value === 1:
-                return 'yes';
-            default:
-                return 'maybe';
-        }
+        return match (true) {
+            $value === 0 => 'no',
+            $value === 1 => 'yes',
+            default => 'maybe',
+        };

RemoveDuplicatedReturnSelfDocblockRector

(DeadCode) — drop @return duplicating native self/static (#​8087)

 final class SomeClass
 {
-    /**
-     * @&#8203;return $this
-     */
     public function some(): self
     {
         return $this;
     }
 }

RemoveMixedDocblockOverruledByNativeTypeRector

(DeadCode) — drop @param mixed / @return mixed overruled by native type (#​8089)

-    /**
-     * @&#8203;param mixed $value
-     * @&#8203;return mixed
-     */
     public function run(int $value): string
     {
     }

RemoveUselessUnionReturnDocblockRector

(DeadCode) — drop @return union broader than a specific native type (#​8126)

-    /**
-     * @&#8203;return bool|mixed|string
-     */
     public function run(): false|string
     {
     }

ClosureReturnTypeFromAssertInstanceOfRector

(TypeDeclaration) — add closure return type narrowed by assertInstanceOf() (#​8115)

-        $callback = function (object $object) {
+        $callback = function (object $object): SomeType {
             $this->assertInstanceOf(SomeType::class, $object);
     return $object;
 };


TypedPropertyFromContainerGetSetUpRector

(TypeDeclaration) — type property from @var when assigned via container get() in setUp() (#​8120)

-    /**
-     * @&#8203;var SomeService
-     */
-    private $someService;
+    private SomeService $someService;

     protected function setUp(): void
     {
         $this->someService = static::getContainer()->get(SomeService::class);
     }

TypedPropertyFromGetRepositorySetUpRector

(TypeDeclaration) — same, for getRepository() assignment in setUp() (#​8124)

-    /**
-     * @&#8203;var SomeEntityRepository
-     */
-    private $someEntityRepository;
+    private SomeEntityRepository $someEntityRepository;

protected function setUp(): void
{
$this->someEntityRepository = $this->em->getRepository(SomeEntity::class);
}



NarrowBoolDocblockReturnTypeRector

(TypeDeclaration) — narrow @return bool to false/true per native type (#​8127)

     /**
-     * @&#8203;return bool|string[]
+     * @&#8203;return false|string[]
      */
     public function run(): false|array

NarrowArrayCollectionUnionReturnDocblockRector

(TypeDeclarationDocblocks) — Type[]|ArrayCollection → generic ArrayCollection<int, Type> (#​8136)

     /**
-     * @&#8203;return LeadEventLog[]|ArrayCollection
+     * @&#8203;return ArrayCollection<int, LeadEventLog>
      */
     public function getSuccessful(): ArrayCollection

AddClosureParamTypeFromVariableCallRector

(TypeDeclaration) — add closure param type from how the closure variable is called (#​8142)

-$printItem = function ($item) {
+$printItem = function (Item $item) {
     echo $item->name;
 };

$printItem(new Item());

rectorphp/rector-symfony 🎵
EventSubscriberMethodReturnVoidRector

(CodeQuality) — subscribed event methods must return void (event is by-reference) (#​949)

-    public function onEvent(Event $event): Event
+    public function onEvent(Event $event): void
     {
-        return $event->setSomething('value');
+        $event->setSomething('value');
     }

rectorphp/rector-phpunit 🟢

PHPUnit 12 cluster — typing createMock() / createStub() properties as intersections after the MockObjectStub split.

ChangeMockObjectReturnUnionToIntersectionRector

(CodeQuality) — MockObject @return union → intersection (#​703)

     /**
-     * @&#8203;return Event|\PHPUnit\Framework\MockObject\MockObject
+     * @&#8203;return Event&\PHPUnit\Framework\MockObject\MockObject
      */
     private function createEvent(): \PHPUnit\Framework\MockObject\MockObject

AddIntersectionVarToMockObjectPropertyRector

(CodeQuality) — add MockObject intersection @var to a native MockObject property (#​697)

+    /**
+     * @&#8203;var \PHPUnit\Framework\MockObject\MockObject&\SomeService
+     */
     private \PHPUnit\Framework\MockObject\MockObject $someServiceMock;

AddStubIntersectionVarToStubPropertyRector

(CodeQuality) — add Stub intersection @var to a native Stub property (#​700)

+    /**
+     * @&#8203;var \PHPUnit\Framework\MockObject\Stub&\SomeService
+     */
     private \PHPUnit\Framework\MockObject\Stub $someServiceStub;

MockObjectVarToStubRector

(PHPUnit120) — on a property retyped to Stub, update @var from MockObject to Stub (#​689)

 /**
- * @&#8203;var FieldModel|MockObject
+ * @&#8203;var FieldModel|\PHPUnit\Framework\MockObject\Stub
  */
 private \PHPUnit\Framework\MockObject\Stub $leadFieldModel;

BareVarToStubIntersectionRector

(PHPUnit120) — add &Stub to a bare single-class @var of a Stub property (#​690)

 /**
- * @&#8203;var FormBuilderInterface
+ * @&#8203;var FormBuilderInterface&Stub
  */
 private \PHPUnit\Framework\MockObject\Stub $formBuilder;

PreferTestsWithCamelCaseRector

(CodeQuality) — rename PHPUnit test methods to camelCase (#​668), Thanks @​Xammie!

-    public function test_something()
+    public function testSomething()
     {
     }

PreferTestsWithSnakeCaseRector

(CodeQuality) — rename PHPUnit test methods to snake_case, the opposite convention (#​668), Thanks @​Xammie!

-    public function testSomething()
+    public function test_something()
     {
     }

Bugfixes 🐛

  • --only / --only-suffix runs now cache under a rule-scoped key (#​8075), Thanks @​SanderMuller!
  • Fix double clear-cache (#​8096)
  • ParamTypeByMethodCallTypeRector split into Object / Scalar / Array rules (#​8134)

Deprecations & Removals 💀

Migrate away - these will be removed in a future release:

  • SwitchTrueToIfRector → use new SwitchTrueToMatchRector (#​8109)
  • StrictStringParamConcatRector — too many false positives (#​8090)
  • StaticClosureRector + StaticArrowFunctionRector (#​8092)
  • StaticCallOnNonStaticToInstanceCallRector — risky change (#​8093)
  • EnumCaseToPascalCaseRector — risky change (#​8095)
  • JoinStringConcatRector (#​8107)
  • RemoveTypedPropertyNonMockDocblockRector — no real value (#​8119)
  • Removed: long-deprecated rules (5+ months old) (#​8094)

rectorphp/rector-symfony

  • ParameterBagToAutowireAttributeRector (#​954)
  • AddRouteAnnotationRector (#​952)

rectorphp/rector-phpunit

  • BehatPHPUnitAssertToWebmozartRector — too narrow (#​686)

v2.5.2: Released Rector 2.5.2

Compare Source

Bugfixes 🐛

  • Match class + path in unused-skip reporting — fix combined class => [paths] skips being wrongly flagged as unused (#​8073)
  • Mark skip used only when rule would change the file — a class/path skip counts as "used" only if the rule would actually touch that file, killing false "used" hits (#​8076)
  • Improve unused-skip resolver methods — cleaner resolution internals (#​8072)
  • Track used skips as class => [paths] map — richer per-path skip tracking backing the report (#​8074)

v2.5.1: Released Rector 2.5.1

Compare Source

Bugfixes 🐛

  • Skip unused-skip reporting on narrowed runs - no more false "unused skip" noise when running Rector on a subset of paths (#​8069)
  • Display skips only on uncached run - skip report shows on real runs, not when results come from cache (#​8071)
  • RemoveAlwaysTrueIfConditionRector — avoid scanning whole new statements on dynamic variable checks; moved logic to ExprAnalyzer and bail early on defined variables (#​8057)

v2.5.0: Released Rector 2.5

Compare Source

New Features 🥳 🎉 🎉 🎉

This release has 3 interesting new features. Let's look at them:

[dx] Report skips that never matched (#​8058)
  • What? - like PHPStan's reportUnusedIgnores, but for Rector ->withSkip(). Flags skip entries that never matched anything during the run, so you can delete stale skips.

  • Why? - skips rot. You skip a path/rule to dodge a problem, later the file moves or the rule stops firing there — the skip lingers forever,
    silently masking nothing. This surfaces dead skips so config stays honest.

// rector.php
return RectorConfig::configure()
    ->withSkip([
        SimplifyUselessVariableRector::class => [
            '*/src/Legacy/*',          // still matches — fine
            '*/NonexistentUnused/*',   // matches nothing — stale
        ],
    ])
    ->reportUnusedSkips();

Run output:

 [OK] Rector is done!
  
 [WARNING] This skip is unused, it never matched any element.
           You can remove it from "->withSkip()"

 * Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector => */NonexistentUnused/*

[dx] Removing unused imports by default (#​8047)

You can update your rector.php config:

 return RectorConfig::configure()
-    ->withImportNames(removeUnusedImports: true);
+    ->withImportNames();

In case it's not for you, turn it off:

 return RectorConfig::configure()
-    ->withImportNames();
+    ->withImportNames(removeUnusedImports: false);

[dx] Introducing Drupal composer-based sets (#​8041), Thanks @​bbrala!

If you're using Drupal Rector, you can now enable it's per-version sets via:

 return RectorConfig::configure()
+    ->withComposerBased(drupal: true);

To learn more about composer-based-sets, checkout the documentation.


New Rules 🎉
  • [php 8.4] [type-declaration] Add AddArrayAnyAllClosureParamTypeRector and NarrowArrayAnyAllNullableParamTypeRector (#​8049)
  • [code-quality] Add MoveInnerFunctionToTopLevelRector (#​8042)
  • [code-quality] Add NewArrayItemConcatAssignToAssignRector (#​8045)
  • [code-quality] Add FixClassCaseSensitivityVarDocblockRector (#​8046)
  • [polyfills] add missing polyfill to PHP 8.4 array functions (#​8052)
  • [rector] Add AddParamTypeToRefactorMethodRector if missing (#​8061)

Bugfixes 🐛

  • [internal] Streamline use imports management to FileNode (#​8040)
  • [PostRector] Do not keep an unused import matched only by a partial docblock name's tail (#​8043), Thanks @​ruudk!
  • [CodeQuality] Skip native function on MoveInnerFunctionToTopLevelRector (#​8044)
  • Fix --only runs caching files as unchanged, hiding pending changes from full runs (#​8029), Thanks @​SanderMuller!
  • [fix] Fix RemoveUnusedPrivateMethodRector for NeverType (#​8050)
  • [dead-code] Fix RemoveUnusedVariableAssignRector, allow for SplFileInfo as cleanup on purpose for gc (#​8054)
  • [fixes] Couple ClassPropertyAssignToConstructorPromotionRector, RemoveAlwaysTrueIfConditionRector and RemoveUnusedVariableAssignRector fixes (#​8055)
  • [TypeDeclaration][DeadCode] Skip class with Doctrine static function mapping (loadMetadata) in TypedPropertyFromAssignsRector and RemoveUnusedPrivatePropertyRector (#​8059)
  • [TypeDeclaration] Skip class with Doctrine static function mapping (loadMetadata) in TypedPropertyFromStrictConstructorRector (#​8060)

rectorphp/rector-doctrine 🟠

  • [NodeAnalyzer] Detect Doctrine static function mapping (loadMetadata) entity in DoctrineEntityDetector (736bf61)

v2.4.6: Released Rector 2.4.6

Compare Source

New Features 🥳

  • [deprecation] Add RenameDeprecatedMethodCallRector inferring rename from @​deprecated docblock (#​8015)
  • [sets] kick of named args set (#​8013)
# rector.php
return (RectorConfig::configure())
    ->withPreparedSets(namedArgs: true);

Bugfixes 🐛

  • [BetterPhpDocParser] Keep import referenced by @​see/@​uses tag with a trailing description (#​8039), Thanks @​ruudk!
  • [internals] skip and finalize beforeTraverse() and afterTraverse() as never used, use refactor() instead (#​7765)
  • [DeadCode] Skip (void) cast with #[NoDiscard] on target method call on RemoveDeadStmtRector (#​8038)
  • Bump composer/pcre to ^3.4.0 and phpstan/phpstan to ^2.2.2 (#​8037)
  • [CodeQuality] Handle crash on custom exception not autoloaded on ThrowWithPreviousExceptionRector (#​8036)
  • refactor: extract AutoloadFileParameterResolver from bin, add tests (#​8035), Thanks @​SanderMuller!
  • Fix cached results surviving a change of --autoload-file (#​8034), Thanks @​SanderMuller!
  • [CodingStyle] Remove AstResolver usage on ArrowFunctionAndClosureFirstClassCallableGuard (#​8031)
  • [DeadCode] Remove AstResolver on RemoveParentCallWithoutParentRector (#​8032)
  • [DeadCode] Skip with use of func_num_args() on RemoveNullArgOnNullDefaultParamRector (#​8030)
  • [Php70] Skip rewriting to $this on static method or static closure on StaticCallOnNonStaticToInstanceCallRector (#​8026)
  • [ci] add compat test (#​8025)
  • Fix ReplaceArgumentDefaultValueRector generating invalid self:: constant in unrelated classes (#​8023)
  • Fix RemoveDeadIfBlockRector dropping else block when merging empty if with elseif (#​8022)
  • Fix RemoveParentCallWithoutParentRector removing valid call when ancestor hierarchy is unresolvable (#​8018)
  • split of RemoveNullNamedArgOnNullDefaultParamRector to handle only named args (#​8014)
  • Add failing tests (#​8012), Thanks @​u01jmg3!
  • Update rector/swiss-knife version to ^2.4.1 (#​8011)

rectorphp/rector-symfony 🎶

  • [Symfony81] Add new rule for deprecated validator test usages (#​948), Thanks @​florianhofsaessC24!
  • fix: only convert Twig extensions fully reducible to AsTwig attributes (#​947)
  • [Symfony73] Sort optional parameters last in InvokableCommandInputAttributeRector (#​945)
  • Add PHPStan rule requiring nested set configs to be imported in parent set config (#​943)
  • [Symfony81] Add new rule for Security component (#​942), Thanks @​MrYamous!
  • Remove unused imports (#​941), Thanks @​MrYamous!
  • [Symfony81] Add new rule for Filesystem (#​940), Thanks @​MrYamous!

rectorphp/rector-phpunit 🟢

  • [PHPUnit12] Handle crash on property not exists on PropertyCreateMockToCreateStubRector (#​681)
  • [AnnotationsToAttributes] Convert external @​depends ClassName::method to #[DependsExternal] (#​679)
  • [PHPUnit12] Drop ConstraintValidatorTestCase from AllowMockObjectsWhereParentClassRector triggers (#​678)

rectorphp/rector-downgrade-php ⬇️

  • Add DowngradeDomNodeChildNodesForeachRector for null $childNodes before PHP 8.0 (#​379)
  • Update boundwize/structarmed version to ^0.9 (#​378)
  • Fix use of existing PhpAttributeAnalyzer service on AddReturnTypeWillChangeAttributeRector (#​377)
  • Remove no longer exists '--ansi' flag from swiss-knife (#​376)
  • [DowngradePhp81] Add AddReturnTypeWillChangeAttributeRector (#​372), Thanks @​jquiaios!

v2.4.5: Released Rector 2.4.5

Compare Source

New Features 🥳

Bugfixes 🐛
  • fix: skip StaticCallToMethodCallRector when parent declares final __construct (#​8001)
  • [NodeManipulator] Use ClassReflection parent isFinalByKeyword()->yes() on ClassDependencyManipulator (#​8002)
  • [BetterPhpDocParser] Don't wrap first-position @​method param union in extra parens (#​8003), Thanks @​kyle-bisnow!
  • [ci] kick of auto issue fixer (#​8004)
  • [automated] Apply Coding Standard (#​8005)
  • [CodeQuality] Skip possibly undefined variable on SimplifyEmptyCheckOnEmptyArrayRector (#​8006)
  • [CodingStyle] Handle namespaced function string on FunctionFirstClassCallableRector (#​8007)
  • Fix compatibility on optional key on array dim fetch to be Mixed on phpstan patch 2.1.x-dev (#​8008)
  • Update Mongodb constant from DoctrineSetList (#​8009)
  • Bump to PHPStan ^2.1.56 (#​8010)
rectorphp/rector-symfony
rectorphp/rector-doctrine
  • [QA] Add StructArmed to QA (#​482)
rectorphp/rector-phpunit
  • [QA] Add StructArmed to QA (#​677)
  • fix assert call type resolving (#​675)
  • fix AssertIsTypeMethodCallRector crash on enum case argument (#​674)
rectorphp/rector-downgrade-php
  • [QA] Add StructArmed to QA (#​375)

v2.4.4: Released Rector 2.4.4

Compare Source

New Features 🥳
  • [QA] Add StructArmed to QA (#​7989)
  • feat: create rector to add names to boolean arguments (#​7944), Thanks @​calebdw!
  • [CodeQuality] Add missing MinPhpVersionInterface implements on AddNameToBooleanArgumentRector (#​7994)
  • [injection] If parent class has dependency via promoted property, but its private, add a new one to child class deps (#​7996)

Bugfixes 🐛
  • Bump structarmed to ^0.6 (#​7990)
  • [Php81] Skip NullToStrictStringFuncCallArgRector for magic __get() property access resolving to ErrorType (#​7992)
  • [automated] Apply Coding Standard (#​7993)
  • [TypeDeclarationDocblocks] Skip overridden methods in DocblockReturnArrayFromDirectArrayInstanceRector (#​7995)
  • Fix compatibility with latest phpstan patch 2.1.x-dev (#​7997)
  • Temporary pin webmozart/assert to 2.3.0 to make downgrade working (#​7998)
  • Bump webmozart/assert to ^2.4 (#​7999)

Removed 💀
  • [DeadCode] Skip used by get_object_vars on RemoveUnusedPromotedPropertyRector (#​7988)
rectorphp/rector-symfony
  • add fixture with failing parent private (#​935)
  • fix ControllerMethodInjectionToConstructorRector - update call sites when params are moved to constructor (#​934)
rectorphp/rector-downgrade-php
  • [DowngradePhp82] Handle nullable true on DowngradeStandaloneNullTrueFalseReturnTypeRector (#​374)

v2.4.3: Released Rector 2.4.3

[Compare Source](https://redire

Note

PR body was truncated to here.


Configuration

📅 Schedule: (in timezone Europe/Vienna)

  • Branch creation
    • "before 5am on monday"
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot enabled auto-merge (squash) May 24, 2026 22:01
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from 00aab19 to 08a8ce5 Compare May 26, 2026 21:28
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.4.4 chore(deps): update dependency rector/rector to ^2.4.5 May 26, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from 08a8ce5 to f5d702c Compare June 17, 2026 17:45
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.4.5 chore(deps): update dependency rector/rector to ^2.4.6 Jun 17, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from f5d702c to f6a60c0 Compare June 20, 2026 20:35
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.4.6 chore(deps): update dependency rector/rector to ^2.5.0 Jun 20, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from f6a60c0 to e8fb45e Compare June 21, 2026 13:11
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.5.0 chore(deps): update dependency rector/rector to ^2.5.1 Jun 21, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from e8fb45e to 40adce0 Compare June 22, 2026 19:01
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.5.1 chore(deps): update dependency rector/rector to ^2.5.2 Jun 22, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from 40adce0 to fff91d2 Compare July 5, 2026 06:04
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.5.2 chore(deps): update dependency rector/rector to ^2.5.3 Jul 5, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from fff91d2 to 84862f1 Compare July 6, 2026 15:10
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.5.3 chore(deps): update dependency rector/rector to ^2.5.4 Jul 6, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from 84862f1 to 8c29391 Compare July 9, 2026 16:35
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.5.4 chore(deps): update dependency rector/rector to ^2.5.5 Jul 9, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from 8c29391 to d06ccae Compare July 12, 2026 13:02
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.5.5 chore(deps): update dependency rector/rector to ^2.5.6 Jul 12, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from d06ccae to da4741b Compare July 13, 2026 19:33
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.5.6 chore(deps): update dependency rector/rector to ^2.5.7 Jul 13, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from da4741b to 83dc7ac Compare July 27, 2026 06:43
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.5.7 chore(deps): update dependency rector/rector to ^2.5.8 Jul 27, 2026
@renovate
renovate Bot force-pushed the renovate/rector-rector-2.x branch from 83dc7ac to 2c95c96 Compare July 31, 2026 03:30
@renovate renovate Bot changed the title chore(deps): update dependency rector/rector to ^2.5.8 chore(deps): update dependency rector/rector to ^2.5.9 Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants