chore(deps): Update dependency rector/rector to v2.6.2 - #325
Open
renovate[bot] wants to merge 1 commit into
Open
chore(deps): Update dependency rector/rector to v2.6.2#325renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/rector-rector-2.x-lockfile
branch
from
July 6, 2026 15:03
1288aba to
e61a62e
Compare
renovate
Bot
force-pushed
the
renovate/rector-rector-2.x-lockfile
branch
from
July 9, 2026 17:43
e61a62e to
e5082da
Compare
renovate
Bot
force-pushed
the
renovate/rector-rector-2.x-lockfile
branch
from
July 12, 2026 17:13
e5082da to
36a2251
Compare
renovate
Bot
force-pushed
the
renovate/rector-rector-2.x-lockfile
branch
from
July 13, 2026 16:58
36a2251 to
0eb7b22
Compare
Contributor
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
2.5.2→2.6.2Release Notes
rectorphp/rector (rector/rector)
v2.6.2: Released Rector 2.6.2Compare Source
The 2.6.0 release introduced composer-based sets. This release finishes the job: every extension package now ships a single composer-based set, and the per-version set providers behind the old guessing game are gone.
Each rule inside checks
composer.json/installed.jsonon its own and runs only if the installed package version matches its constraint. NoSymfonySetList::SYMFONY_63, no picking a PHPUnit version by hand. We're working hard to bring Drupal and Laravel community packages to the same system.Run only the PHP rules (#8322)
A new
--phpoption on theprocesscommand runs only rules bound to a minimal PHP version — those implementingMinPhpVersionInterface. Useful to split a PHP upgrade from the rest, without a second config:New features 🥳
--phpoption to run only PHP version rules (#8322)withComposerBased()(#8332), load Doctrine and Twig composer-based sets (#8313)--onlyrule exists but is not registered inrector.php(#8300)New rules 🎉
rector-src
RemoveRedundantTypeCheckRector(#8307)rector-symfony
EnableValidationAttributesRector(#1004)Simple(Pre|Form)AuthenticatorInterfacefromCoretoHttpnamespace (#1031)rector-phpunit
AnyMatcherToNewAnyInvokedCountRectorfor the deprecatedany()matcher (#764)Bugfixes 🐛
withPhpSets()version (#8315) —withPhpSets(php82: true)withsymfony/polyfill-php83installed no longer produces PHP 8.3 codeInlineConstructorDefaultToPropertyRectoron non-final class (#8310) and on a property defined in the parent whenparent::__construct()is called (#8297)SimpleXMLElementonIssetOnPropertyObjectToPropertyExistsRector(#8284)RemoveParentDelegatingConstructorRectoron protected parent constructor (#8309)assert()enforcement that producesNeverTypeonNarrowWideUnionReturnTypeRector(#8282)AssignArrayToStringRectoron a variable re-assigned as string (#8293)ArrayToFirstClassCallableRectorwhen the arg type does not accept aClosure(#8288), drop the Symfony PHP closure check (#8291)Set changes 📈
DeprecatedAnnotationToDeprecatedAttributeRectorfrom the PHP 8.4 set and polyfills (#8326)AddOverrideAttributeToOverriddenMethodsRectorfrom the PHP 8.3 and polyfill sets (#8321)RemoveReadonlyPropertyVisibilityOnReadonlyClassRector(#8289),SimplifyBoolIdenticalTrueRectorandUnwrapSprintfOneArgumentRector(#8285) to the dead-code setPropertyExistsWithoutAssertRectorin the composer-based set (#761)Deprecations 💀
Deprecated rules run without any effect, and print a warning and will be removed in a future major release.
These were deprecated as not part of any set, risky, opinionated or excluded by most users. The goal is to keep Rector valuable and reliable for the every day user.
rector-src
DeprecatedAnnotationToDeprecatedAttributeRectorandConstAndTraitDeprecatedAttributeRector(#8347)AddInterfaceByTraitRector(#8346)RemoveAnnotationRector(#8345)ScalarValueToConstFetchRector(#8344)FuncCallToMethodCallRector(#8343)AddReturnArrayDocblockBasedOnArrayMapRector(#8342)AddAssertArrayFromClassMethodDocblockRector(#8341)AddParamArrayDocblockBasedOnArrayMapRector(#8340)AddReturnDocblockForDimFetchArrayFromAssignsRector(#8338)AddSensitiveParameterAttributeRector(#8337)PropertyHookRector— property hooks are a matter of preference (#8331)JsonThrowOnErrorRector— can cause BC breaks (#8327)CoalesceToTernaryRector— risky (#8324)ChangeNestedIfsToEarlyReturnRector(#8304),ChangeNestedForeachIfsToEarlyContinueRector(#8303),ReturnBinaryOrToEarlyReturnRector(#8302),ChangeOrIfContinueToMultiContinueRector(#8299)DisallowedEmptyRuleFixerRector(#8290)NestedFuncCallsToPipeOperatorRectorandSequentialAssignmentsToPipeOperatorRector(#8286)SwitchNegatedTernaryRector(#8283)cacheClass()— the file-vs-memory cache storage choice moved intoCacheFactory; onlyFileCacheStorageis ever useful to end users (#8311)symfonyRouteandsymfonyValidatorargs inwithAttributesSets()(#8317)ComposerTriggeredSetin favor ofComposerPackageConstraintInterface(#8296)withComposerBased(netteUtils:)argument (#8329)rector-symfony
ActionSuffixRemoverRector(#1022)ControllerMethodInjectionToConstructorRector(#1020)TraitGetByTypeToInjectRector(#1002)RemoveDefaultGetBlockPrefixRector(#1017)rector-doctrine
RemoveEmptyTableAttributeRector(#505)MoveCurrentDateTimeDefaultInEntityToConstructorRector, drop theforce_nullableoption (#504)Removals 💀
nette/utilsset and its singleUtilsJsonStaticCallNamedArgRectorrule (#8329) — the only third-party-library rule left in rector-src, readability onlyNewInInitializerRector(#8328)SymfonySetProvider,PHPUnitSetProvider(#8295) andDoctrineSetProvider(#8298) from the collectorTwigSetProvider(#1015) and the empty Symfony per-version set providers (#1012)PHPUnitSetProvider(#759)DoctrineSetProvider(#501), drop the unusedsymfony/yamldependency (#500)rectorphp/rector-symfony 🎵
AsTwigFilter/AsTwigFunctionrules into a single rule, addgetTests()support (#1027), restore the merged rules as deprecated (#1028)ControllerMethodInjectionToConstructorRector: re-use the parent protected property (#1003), skip event and session params (#1005), use#[Required]autowire()when the parent has a constructor (#1006), skip type-guarded classes and use a unique autowire method name (#1007), re-use an existing#[Required]method (#1008)LoadValidatorMetadataToAttributeRector: skip non-constant constraint args (#1000) and constraints without their own constructor (#1001)AddParamTypeDeclarationto nullable types where the upstream param defaults to null (#1023)GetRequestRector(#1013), move it to the Symfony 2.5 set (#1009)Twig_Tests_EnvironmentTest_Extensionrename (#1016)rectorphp/rector-phpunit 🧪
AddDoesNotPerformAssertionToNonAssertingTestRector: add the attribute directly and skip traits (#765), removeaddToAssertionCount()calls (#763), skip TwigIntegrationTestCasechildren (#762)Internals and CI 🧰
*.php.incsuffix, not bare*.inc(#8306)--onlyquote variants, revive the orphaned rules-summary test (#8334), remove the attributes e2e test (#8333)list-non-composer-based-rules.php(#8276)actions/checkoutto v5 for Node.js 24 (#8335), bump outdated actions to current majors (#8336), bump lock-threads, stale and typos actions (#8339)v2.6.1: Released Rector 2.6.1Compare Source
Bugfix 🐛
composer-basedcommand on a lazy-initialized property, e.g. PHPStanUnionType::$normalized(#8280)Composer-based sets keep growing: Twig, nette/utils and the rest of Symfony 📦
Follow-up release to 2.6.0. The composer-based rollout continues - Twig and nette/utils join, and every remaining Symfony rule now declares the package version its target API was added in.
The new Twig composer-based set replaces the
twig112→twig127→ ... →twig30chain with a single set, where every rule checks the installedtwig/twigversion:final class SomeTwigUse { - public function run(Twig_Environment $twigEnvironment) + public function run(\Twig\Environment $twigEnvironment) { - return new Twig_SimpleFilter('some_filter', 'strlen'); + return new \Twig\TwigFilter('some_filter', 'strlen'); } }Package bonding (composer-based rollout) 📦
nette/utilsrules to the installed package version;nette-utils4.phpbecomescomposer-based.phpand is loaded as a single set (#8275)LoadValidatorMetadataToAttributeRectorin the composer-based set - the last interface-bonded rule left outside it (#997)ContainerInterfaceServiceToServiceContainerRectortosymfony/dependency-injection>=6.0 (#999)AddGetReferenceTypeRectortodoctrine/data-fixtures>=1.6 and the annotation-to-attribute sets to their package constraints (#497)RemoveExpectAnyFromMockRectorto PHPUnit 11+ (#756) ** landed in 2.6.0, missing from its release notes
The per-version sets are not touched - every rule stays registered where it was.
Set changes 📈
ConsistentImplodeRectorfrom the coding style level - the swappedimplode($array, $glue)signature was removed in PHP 8.0, so the rule belongs to thephp80set only, where it already is (#8273)DoctrineSetList::COMPOSER_BASEDconstant, remove the emptyDOCTRINE_BUNDLE_210set (#499)Bugfixes 🐛
AddParamArrayDocblockFromAssignsParamToParamReferenceRector(#8271)returninConsoleExecuteReturnIntRectoron a trailing comment (#992), plus a fixture for a block comment with a commented-out return (#993)(int)cast on amatchreturn inConsoleExecuteReturnIntRector- amatchof int constants is aUnionType, so theinstanceof IntegerTypecheck missed it (#998)public function execute(InputInterface $input, OutputInterface $output): int { - return (int) match ($input->getArgument('type')) { + return match ($input->getArgument('type')) { 'a' => 0, default => 1, }; }Deprecations 💀
Deprecated rules still run, but print a warning and will be removed in a future major release.
These are coding standard preferences or opinionated rewrites - a coding standard tool is the better place for them.
rector-src
WrapEncapsedVariableInCurlyBracesRector- also removed from the coding style level (#8272)function run($world) { - echo "Hello $world!"; + echo "Hello {$world}!"; }The actual PHP 8.2 deprecation,
${var}, is covered byVariableInStringInterpolationFixerRectorin thephp82set.CountArrayToEmptyArrayComparisonRector- also removed from the coding style level (#8274)ArraySpreadInsteadOfArrayMergeRector- the spread result is harder to read, and...mid-array looks dangerous in review (#8277)UnusedForeachValueToArrayKeysRector- also removed from the code quality level (#8278)rector-doctrine
GetRepositoryServiceLocatorToRepositoryServiceInjectionRector- it resolved the repository class by running a regular expression over the entity file contents (#498)Renames 🔄
ReplaceServiceArgumentRector→ContainerInterfaceServiceToServiceContainerRector, no longer configurable (#999)Both sets configured it with the same 2 values, for a single Symfony 6.0 BC break - the
Psr\Container\ContainerInterfaceandSymfony\...\DependencyInjection\ContainerInterfacealiases of theservice_containerservice were removed. Now hardcoded, and theReplaceServiceArgumentvalue object is gone.v2.6.0: Released Rector 2.6.0Compare Source
Composer-based sets - let Rector handle upgrade from
composer.json🥳The main theme of this release: rules that turn themselves on based on the package versions you actually have installed.
Instead of picking a Symfony or PHPUnit set by version number and guessing what applies, register the composer-based set once. Every rule inside checks
composer.json/installed.jsonand only runs if the installed package version matches its constraint.We're working on full coverage. At the moment, PHPUnit and Symfony rules are already migrated to this approach. Not only rules, but also rule configuration can be bound to a package version:
To see what is active and why, there is a new command:
And to run only those rules in a single process:
New features 🥳
ruleWithConfigurationComposerVersionBound()(#8244)composer-basedcommand (#8246)--composer-basedprocess filter (#8248)withComposerBased()(#8255)withComposerBased()(#8259)composer.json(#8264)New rules 🎉
rector-src
RemoveTestsOverriddenPrivateMethodParameterRector(#8254)rector-phpunit
AddIntersectionParamToMockObjectParamRector(#755)ExpectsParamToMockObjectRector— for private test method params (#753)MockObjectArgCreateStubToCreateMockRector(#741)AssertContainsOnlyMethodCallRector(#738)rector-symfony
LoadValidatorMetadataToAttributeRector(#988)Bugfixes 🐛
RecastingRemovalRectoron array dim fetch value (#8262)RemoveDefaultValueFromAssignedPropertyRectoron early return in constructor-called method (#8261)RemoveDefaultValueFromAssignedPropertyRector(#8240)createStub()in tests (#8257)--onlyrule name with shell-eaten backslashes (#8267)composer.jsonconstraint over outdatedinstalled.jsonversion (#8242)InstalledPackageResolvercwd fallback lost by promoted property (#8237)preConditionandpostConditionattribute mapping (#746)DataProviderAnnotationToAttributeRector(#751, #752)Set changes 📈
ExplicitPublicClassMethodRectorto PHP 5.3, plus one each to code quality and dead code (#8266)MinMaxToClampRectorfrom coding style level (#8270)SymfonySetList::COMPOSER_BASED(#982)PHPUnitSetProvider(#748)Deprecations 💀
Deprecated rules still run, but print a w and will be removed in a future major release.
These were deprecated as not part of any set, risky, opinionated or excluded by most users. Goal is to make Rector useful more to masses and every day user by having valuable and reliable rules.
rector-src
EncapsedStringsToSprintfRector(#8265)SimplifyRegexPatternRector(#8263)BinaryOpStandaloneAssignsToDirectRector(#8269)NullableCompareToNullRector(#8268)NestedTernaryToMatchRector(#8241)AddReturnDocblockFromMethodCallDocblockRector(#8239)withPhp53Sets()...withPhp74Sets()— usewithPhpLevel()instead (#8253)cacheMetaExtension()— reports a warning when used (#8251)rector-doctrine
YamlToAttributeDoctrineMappingRector(#492)DoctrineSetList::YAML_TO_ANNOTATIONSset (#493)rector-symfony
TemplateAnnotationToThisRenderRector(#989)ReturnDirectJsonResponseRector(#987)AutowireAttributeRector(#981)rector-phpunit
WillReturnCallbackFallbackToThrowRector(#740)ReplaceTestFunctionPrefixWithAttributeRector(#739)Removals 💀
strict-booleansset, deprecated since 2025-10 (#8243)junitoutput format (#8250)DoctrineDocBlockResolver, deprecated since 2025-05 (#491)StringExtensionToConfigBuilderRector, deprecated since 2025-10 (#978)AssertPropertyExistsRector(#742)Package bonding (composer-based rollout)
AddViolationToBuildViolationRectortosymfony/validator2.5 (#983), addAuthorizationCheckerIsGrantedExtractorRectorto the composer-based set (#985), bondRedirectToRouteRectortosymfony/framework-bundle2.6 (#991)phpunit/phpunit>=11.0 (#750), bond annotation-to-attribute rules tophpunit/phpunit>=10.0 (#744, #745), move composer version bound rules to composer-based set (#747)v2.5.9: Released Rector 2.5.9Compare Source
Bugfixes 🐛
Class_-only rules (#8217)AstResolverusage onAddParamBasedOnParentClassMethodRector(#8196)RichParsernode visitors via DI factory instead of private property hack (#8215)ClassPropertyAssignToConstructorPromotionRector(#8232)__construct()in anonymous class that extends parent onRemoveEmptyClassMethodRector(#8219)RemoveDeadZeroAndOneOperationRector(#8213)RemoveDefaultValueFromAssignedPropertyRector(#8214)RemoveDefaultValueFromAssignedPropertyRector(#8212)RemoveDefaultValueFromAssignedPropertyRector(#8211)RemoveDefaultValueFromAssignedPropertyRector(#8209)Set changes 🗑️
NullToStrictStringFuncCallArgRectorout 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:
AddReturnArrayDocblockFromDataProviderParamRectorAddReturnDocblockDataProviderRectorAddParamArrayDocblockFromDataProviderRectorrectorphp/rector-symfony 🎵
push()to its ownRequestStackvariable inPushRequestToRequestStackConstructorRector(#971)isGranted()service calls in controllers inAuthorizationCheckerIsGrantedExtractorRector(#973)Cookiefixture afterNewToStaticCallRectorconfig removal (#974)rector/type-perfect, its rules ship intomasvotruba/type-coverage2.3 now (#972)symfony/configto^8.1(#977)Deprecated:
SimplifyFormRenderingRector(#975)The rule removed the explicit
->createView()call when a form was passed torender():Symfony supports passing the
FormInterfacedirectly, but the shorthand is ambiguous and breaks dynamic forms: forms modified inPRE_SET_DATA/POST_SUBMITlisteners 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 🧪
expectExceptionMessage()rename toTestCase(#735)rectorphp/rector-downgrade-php ⬇️
MHASH_*constants by name inDowngradeHashAlgorithmXxHashRectorto fix PHP 8.5 deprecation (#386)v2.5.8: Released Rector 2.5.8Compare Source
New Features 🥳
Bugfixes 🐛
Removed 💀
rectorphp/rector-symfony 🎵
rectorphp/rector-doctrine 🟠
rectorphp/rector-phpunit 🟢
v2.5.7: Released Rector 2.5.7Compare 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_ASSERTSsetA 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)withPreparedSets()gainsphpunitNarrowAsserts+phpunitMockToStubThe 2 PHPUnit sets are now toggleable like any other prepared set. (#8178)
PHPUnit: flip
with($this->callback(...))on void methods towillReturnCallback()VoidMethodWithCallbackToWillReturnCallbackRector(renamed + refocused) drops the pointlessreturnvalue and types the closure asvoid, 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:
-vas alias for--versionSince the
verboseoption was removed,-vnow prints the version. (#8177)vendor/bin/rector -v # Rector 2.x.xImprovements 🔧
literal-string,numeric-string, …) to their real PHPStan types instead of a bogusObjectType, so precise docblocks survive dead-code cleanup (#8176)Assertclass via reflection before transforming (rector-phpunit #720)CallbackSingleAssertToSimplerRector(rector-phpunit #722)atLeast()instead ofexactly()inDecorateWillReturnMapWithExpectsMockRector(rector-phpunit #719)Bug Fixes 🐛
@returntags inRemoveReturnTagIncompatibleWithNativeTypeRector(#8183)RemoveReturnTagIncompatibleWithNativeTypeRector(#8180)RemoveReturnTagIncompatibleWithNativeTypeRector(#8179)CompleteDynamicPropertiesRector(#8182)@methodinRemoveExtraParametersRector(#8181)with()multiple arguments inVoidMethodWithCallbackToWillReturnCallbackRector(rector-phpunit #725)newobject instances inNarrowIdenticalWithConsecutiveRector— eachnewis a fresh instance, collapsing them changes intent (rector-phpunit #726)CallbackSingleAssertToSimplerRector(rector-phpunit #718)AssertEqualsToSameRectorto preserve loose comparison (rector-phpunit #717)Deprecations 💀
Symfony:
WebTestCaseAssertIsSuccessfulRector+WebTestCaseAssertResponseCodeRectorBoth 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.6Compare Source
New Features 🥳
RemoveReturnTagIncompatibleWithNativeTypeRector(#8172)final class SomeClass { - /** - * @return SomeObject - */ public function getName(): string { return $this->someObject->getName(); } }MergePhpstanDocTagIntoNativeRectorto merge@phpstan-*doc tags into native tags (#8171)final class SomeClass { /** - * @var Collection - * - * @phpstan-var Collection<int, string> + * @va > ✂ **Note** > > PR body was truncated to here. </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/ericsizemore/clock). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNDIuMiIsInVwZGF0ZWRJblZlciI6IjQ0LjI0LjAiLCJ0YXJnZXRCcmFuY2giOiJtYXN0ZXIiLCJsYWJlbHMiOlsiZGVwZW5kZW5jeSJdfQ==-->