Skip to content

chore(deps): update dependency rector/rector to ^2.6.7 (master) - #3007

Merged
renovate[bot] merged 1 commit into
masterfrom
renovate/master-rector-rector-2.x
Oct 3, 2026
Merged

renovate[bot] merged 1 commit into
masterfrom
renovate/master-rector-rector-2.x

Conversation

@renovate

@renovate renovate Bot commented Oct 3, 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.0 → ^2.6.7 age confidence

Release Notes

rectorphp/rector (rector/rector)

v2.6.7: Released Rector 2.6.7

Compare Source

Agentic Experience

This release improves Rector for automated, CI and non-interactive workflows: validate configuration without processing files, limit the amount of changes per run, select multiple rules at once, and get more useful machine-readable output.

  • Bump PHPStan to ^2.2.14 and PHP-Parser to ^5.9, regenerate preload (#​8491)
New validate-config command (#​8450, #​8452)

New validate-config command checks rector.php for configuration issues without processing any source files.

vendor/bin/rector validate-config

It reports deprecated rules and configuration, invalid skips, duplicated rule registrations and other config hygiene issues. A valid config exits with 0, while detected issues exit with 1, so the command can be used directly as a CI gate.

For machine-readable output:

vendor/bin/rector validate-config --output-format=json
{
    "valid": true,
    "issue_count": 0
}
Limit a run with --max-changes (#​8449)

New --max-changes option lets automated runs process changes in smaller batches:

vendor/bin/rector process --dry-run --max-changes=50

The limit counts applied rule changes rather than files. The current file is always finished before Rector stops, so the final number may be slightly above the requested limit.

Run multiple rules with --only (#​8451)

--only can now be repeated to run several selected rules in a single pass:

vendor/bin/rector process \
    --only=App\\Rector\\FooRector \
    --only=App\\Rector\\BarRector

A single --only continues to work as before.

Per-line rule attribution in JSON output (#​8448)

JSON output now includes a changes list with the Rector rule and source line for every applied change:

{
    "changes": [
        {
            "rector": "Rector\\Php80\\Rector\\Identical\\StrStartsWithRector",
            "line": 38
        }
    ]
}

The existing applied_rectors field remains unchanged for backward compatibility.

Cleaner non-interactive output

Non-interactive runs are now quieter and safer:

  • Disable progress bar when output is not a TTY (#​8444)
  • Never emit ANSI escape sequences to non-TTY output, even with --ansi (#​8453)
  • Do not prompt or automatically create rector.php when input is non-interactive (#​8454)

Sets

  • Add DirnameDirConcatStringToDirectStringPathRector to the code-quality set (#​8470)
  • Add NarrowBoolDocblockReturnTypeRector to the type-declaration-docblocks set (#​8484)

Bugfixes 🐛

  • CompleteDynamicPropertiesRector: skip when a not-autoloaded ancestor may already declare the property (#​8441)
  • TypeDeclarationDocblocks: restrict array docblock inference to safer/private cases and avoid narrowing properties with incompatible assignment shapes (#​8435, #​8436, #​8437, #​8442)
  • DocblockVarArrayFromPropertyDefaultsRector: widen empty nested array defaults to mixed[] instead of never[] (#​8439, #​8474)
  • DocblockReturnArrayFromDirectArrayInstanceRector: skip empty array returns instead of producing an overly narrow array{} docblock (#​8434)
  • IfToNullCoalescingAssignRector: preserve comments inside the converted if (#​8443)
  • RemoveDeadIfBlockRector: keep empty if with elseif and trailing else where rewriting would change behavior (#​8446)
  • RemoveParentDelegatingClassMethodRector: keep delegating methods carrying annotations such as @Route (#​8459)
  • StrContainsRector: skip empty string needles to avoid behavior changes (#​8460)
  • Parallel processing: guard processes that quit before their encoder is initialized, fixing crashes with high worker counts (#​8461)
  • RemoveDeadCatchRector: keep rethrowing catches before catch-all Throwable/Exception handlers (#​8462)
  • SimplifyUselessVariableRector: preserve variables referenced by commented-out code and stop folding compound assignments into returns (#​8468)
  • ReplaceArgumentDefaultValueRector: avoid re-applying already migrated imported class constants and correctly report applied changes (#​8475)
  • Terminated block detection: ignore trailing comments and recognize terminating infinite loops (#​8476)
  • ForeachToArrayAnyRector: do not drop elseif or else branches when converting a foreach (#​8480)
  • Set Option::SOURCE from the actually resolved paths in regular Rector runs (#​8424)

Deprecations 💀

  • --rules-summary - use --output-format=json, which provides applied rules together with files and lines (#​8457)
  • DynamicDocBlockPropertyToNativePropertyRector - could change a public-by-design @property into a private native property (#​8470)
  • FluentSettersToStandaloneCallMethodRector and RemoveReturnThisFromSetterClassMethodRector - fluent API semantics are too use-case dependent for a generic transformation (#​8473)
  • ListSwapArrayOrderRector - can turn valid list() assignments into broken code; removed from PHP 7.0 sets (#​8477)
  • Remove RenameDeprecatedMethodCallRector - inferring replacement methods from free-text @deprecated descriptions is too risky; explicit rename rules are more predictable (#​8485)

rector-doctrine 🟠

  • TypedPropertyFromToOneRelationTypeRector: skip untyped parent property overrides (#​520)
  • TypedPropertyFromColumnTypeRector: skip untyped parent property overrides (#​521)
  • TypedPropertyFromColumnTypeRector: fix numeric defaults for decimal/bigint columns (#​522)
  • TypedPropertyFromColumnTypeRector: make generated property type nullable when a null default is present (#​523)

rector-phpunit 🟢

  • Deprecate RemoveNamedArgsInDataProviderRector (#​782)

rector-symfony 🎵

  • Move EnableValidationAttributesRector into the composer-based upgrade path (#​1065)
  • ConsoleExecuteReturnIntRector: correctly report changes when rewriting an existing return (#​1064)

rector-downgrade-php ⬇️

  • DowngradeNeverTypeDeclarationRector: support never return types on arrow functions (#​397)
  • Add DowngradeReflectionMethodHasPrototypeRector for ReflectionMethod::hasPrototype() when downgrading below PHP 8.2 (#​398)

v2.6.6: Released Rector 2.6.6

Compare Source

File selection

--filter option to narrow processed files (#​8419)

New --filter option keeps only files whose path matches all given patterns. Repeat the option to require several patterns at once, handy for scoping a run to a subtree or a naming convention without editing config paths.

vendor/bin/rector process src --filter Controller --filter Admin

Before: process every file under the given paths. After: process only files matching all --filter patterns.

Bugfixes 🐛

  • Add back RectorConfig::tag() as a no-op BC layer (#​8431)
  • TypeDeclarationDocblocks: fix invalid array-in-key docblock when narrowing long array unions (#​8430)
  • BetterPhpDocParser: keep import used only in an annotation array key (#​8429)
  • RenameVariableToMatchMethodCallReturnTypeRector: fix partial rename with same-named nested arrow param (#​8428)
  • ArrayFirstLastRector: skip nested compound assignment (#​8425)
  • ReturnTypeFromStrictNewArrayRector: add doc return type only for list and generic arrays (#​8423), skip noisy array-shape union return docblock (#​8422)

Extension packages

rector-phpunit 🟢
  • AllowMockObjectsForDataProviderRector: skip dynamic method call (#​781)
  • AssertEmptyNullableObjectToAssertInstanceofRector: skip assertNull/assertEmpty (#​780)
  • AddSeeTestAnnotationRector: skip existing imported or short @see annotation (#​779)
rector-downgrade-php ⬇️
  • DowngradeSetAccessibleReflectionPropertyRector: handle getProperties()/getMethods() loop (#​396)
  • DowngradeHashAlgorithmXxHashRector: skip PHP_VERSION_ID guarded hash() calls (#​394)

Internal / cleanup

  • Add mspirkov/yii2-rector link to README (#​8427)
  • Add fixtures for arrow functions returning a ?? expression (#​8421)

v2.6.5: Released Rector 2.6.5

Compare Source

Caching

This release makes the cache smarter about config changes - fewer needless full re-runs, while still invalidating when results could actually differ.

Configured rule value changes now invalidate the cache (#​8400)

withConfiguredRule() stored its config on the RectorConfig instance only, never in the cache hash. Changing a rule's values - same class, different config - kept serving the stale result.

 return RectorConfig::configure()
     ->withConfiguredRule(SomeRector::class, [
-        'old value',
+        'new value',
     ]);

Before: cache kept, files re-analysed with stale value. After: cache dropped, re-analysed with new value. Merged config now flows through a RULE_CONFIGURATIONS parameter into the strict cache hash. Upgrading invalidates the cache once for projects using configured rules.

--only <Rule> reuses the full-run cache (#​8400)

Each --only selection has its own cache namespace, so a file left clean by a prior full run was re-analysed under --only even when nothing changed. A scoped run now falls back to the full-run cache (read only, file content still compared, so real edits are still picked up).

vendor/bin/rector process       # full run, files left clean are cached
vendor/bin/rector process --only "Rector\..\SomeRector"

Before: --only re-analyses every file. After: skips files the full run already left clean.

Directional cache invalidation on config change (#​8397)

Previously any change to any config parameter dropped the whole cache. Now changes are compared by direction:

  • removing a rule/set, or adding a skip -> strictly less work -> cache kept
  • adding a rule/set, or removing a skip -> more work possible -> cache dropped
  • output-affecting params (php version, import names, indent) -> any change still drops the cache
  • runtime/reporting params (--parallel, memory limit, deprecation notices) -> never invalidate
 return RectorConfig::configure()
     ->withRules([
         SomeRector::class,
-        OtherRector::class,     // removing a rule -> cache kept
     ]);
 return RectorConfig::configure()
     ->withSkip([
         SomeRector::class,
+        AnotherRector::class,   // adding a skip -> cache kept
     ]);

Before: full cache dropped, every file re-analysed. After: cache kept, only changed files re-analysed. A legacy cache value from an older version triggers a single safe reset.

Bugfixes 🐛

  • Support PHPStan 2.2.10 scope changes (#​8420)
  • Fix double backslash in FunctionFirstClassCallableRector (#​8398)
  • IfToNullCoalescingAssignRector: fix isset guard never converting (#​8389), keep comments above if (#​8388), skip non-nullable typed property (#​8387)
  • InlineIfToExplicitIfRector: skip same local method call and call chain (#​8417, #​8418)
  • ArrowFunctionDelegatingCallToFirstClassCallableRector: skip callee arity mismatch (#​8391)
  • Fix newline formatting of deprecated skipped rules warning (#​8386)

Deprecations 💀

Rules:

  • ShortenElseIfRector (#​8416)
  • CombineIfRector (#​8413)
  • ExplicitBoolCompareRector - can make if-train less readable (#​8412)
  • SimplifyIfElseToTernaryRector - avoids less readable code (#​8411)

Sets and config:

  • SetList::IF - rules moved into code-quality and coding-style sets (#​8414)
  • SetList::INSTANCEOF - rules moved into code-quality and type-declaration sets (#​8408)
  • SetList::PHP_* constants - use withPhpSets() / withPhpLevel() instead (#​8405)
  • Deprecate group approach for composer-based sets; load from Laravel and Drupal directly (#​8406)
  • Mark prepared sets params and withCacheMetaExtension() as @deprecated (#​8415)
  • Disable withSetProviders() (#​8392)

Console commands:


Internal / cleanup

  • Inline symplify/easy-parallel into src/Parallel (#​8401)
  • Reuse RectorCheaperGuardsFirstRule from symplify/phpstan-rules (#​8404)
  • Remove SingleServiceRegistrationRule, drop unused react/promise (#​8403)
  • Remove unused RelatedConfigInterface, dead stub files (#​8395, #​8407)
  • Trim redundant Issues regression tests (#​8399)

v2.6.4: Released Rector 2.6.4

Compare Source

A tooling release under the hood: Rector's dependency-injection container moves off illuminate/container onto entropy/entropy, and composer-based sets now target the lowest declared version of a library instead of guessing the current one.


New rules 🎉

rector-src
  • [Php7.4] IfToNullCoalescingAssignRector — convert an if null-guard into ??= (#​8356)
  • [Php7.3] ArrayKeysToArrayKeyFirstLastRector — array_keys($a)[0] → array_key_first($a) (#​8238)
rector-symfony
  • [Web Link] WebLinkStringRelationsToConstantsRector (#​1058)

Engine 🔧

  • Switch the DI container from illuminate/container to entropy/entropy (#​8362) — lighter container, order-independent service collections via autodiscover()
  • [VersionBonding] Allow a rule to require multiple composer package constraints at once (#​8355)
  • [Composer] Target the lowest declared version for libraries in composer-based sets; only a project package type is treated as an application (#​8359, #​8363)
  • [Configuration] Skip deprecated rules pulled in from an active set — warn only instead of crashing (#​8358)
  • [DI] Register PHPStan PhpVersionFactory as a public service so third-party rules can autowire it (#​8365)
  • [PhpParser] Merge decorating node visitors from 14 to 8 for faster traversal (#​8380)

Bugfixes 🐛

rector-src
  • [TypeDeclarationDocblocks] Skip ClassMethodArrayDocblockParamFromLocalCallsRector on methods overriding a parent/interface (#​8357)
  • [TypeDeclarationDocblocks] Skip a contradicting @param array when the local call type conflicts with the default value (#​8381)
  • [Naming] Skip a valid singular name with an ous suffix in RenameForeachValueVariableToMatchExprVariableRector (#​8382)
rector-symfony
  • [Symfony 6.1] Skip CommandConfigureToAttributeRector on non-constant configure() values (#​1057)
  • [Symfony 3.4] Skip ContainerGetNameToTypeInTestsRector when the named service has no matching FQCN service (#​1051)
  • [Symfony 3.0] Skip OptionNameRector when no option name changes (#​1044)
rector-phpunit
  • [CodeQuality] Fix AddInstanceofAssertForNullableArgumentRector duplicating assertInstanceOf inside traits (#​773)
  • [CodeQuality] Fix MatchAssertSameExpectedTypeRector rewriting a passing assert into a failing one (#​771)

Set changes 📈

rector-src
  • [CodeQuality] Add FlipNegatedTernaryInstanceofRector to the code quality level (#​8385)
rector-symfony
  • [Symfony 7.3] Add missing rename function call (#​1056)
  • [Symfony 7.2] Add missing rename class and function calls (#​1055)
  • [CodeQuality] Move RequestIsMainRector and other version-bonded rules to the composer-based set (#​1048, #​1045)
  • [Symfony 7.3] GetFiltersAndFunctionsToAsTwigAttributeRector — support arrow-call functions; gate on symfony/twig-bridge 7.3, not twig alone (#​1043, #​1050)
  • [Set] Mark ANNOTATIONS_TO_ATTRIBUTES as @internal instead of @deprecated (#​1053)
rector-doctrine
  • Move AddAnnotationToRepositoryRector to the composer-based set only (#​510)

Deprecations 💀

Deprecated rules run without any effect, print a warning and will be removed in a future major release.

rector-symfony
  • [CodeQuality] InlineClassRoutePrefixRector (#​1049)
  • [CodeQuality] AddTraitGetterReturnTypeBasedOnSetterRequiredRector (#​1047)
  • [CodeQuality] LiteralGetToRequestClassConstantRector (#​1046)

Removals 💀

rector-src
  • [Cleanup] Remove the write-only CallLikeThisBoundClosureArgsNodeVisitor and its unread attribute (#​8373)

v2.6.3: Released Rector 2.6.3

Compare Source

A stabilization release on top of the composer-based sets finished in 2.6.2 - bugfixes across the engine, a couple of fresh Symfony and Doctrine rules, and the caching cleanup that the cacheClass() deprecation promised.

New rules 🎉

rector-symfony
  • [Symfony 6.1] RouteRequirementStringToConstantRector (#​1037)
rector-doctrine
  • [DBAL 3.1] QueryBuilderExecuteToExecuteQueryOrExecuteStatementRector — split the deprecated execute() into executeQuery() / executeStatement() (#​507)

Bugfixes 🐛

  • [DeadCode] Skip RemoveReturnTagIncompatibleWithNativeTypeRector on a type alias nested in a union (#​8319)
  • [NodeAnalyzer] Treat an infinite loop without a break as always terminated (#​8348) — improves return/dead-code analysis on while (true) bodies
rector-symfony
  • [CodeQuality] Fix InlineClassRoutePrefixRector duplicating the route name prefix on attribute routes (#​9851)
  • [Symfony 7.2] Fix PushRequestToRequestStackConstructorRector leaving the pushed request undefined (#​1040)
  • [CodeQuality] Skip loadValidatorMetadata() containing addConstraint(new Callback()) (#​1038)
rector-phpunit
  • [PHPUnit 6.0] Skip imported PHPUnit assert functions in AddDoesNotPerformAssertionToNonAssertingTestRector (#​767)

Set changes 📈

rector-doctrine
  • [ORM 3.5] Replace deprecated ORMSetup methods — createAttributeMetadataConfiguration() → createAttributeMetadataConfig(), createXMLMetadataConfiguration() → createXMLMetadataConfig(), createConfiguration() → createConfig()
  • [DBAL 4.0] Replace the removed Types::ARRAY with Types::SIMPLE_ARRAY (#​506)

Deprecations 💀

Deprecated rules run without any effect, print a warning and will be removed in a future major release.

rector-phpunit
  • AllowMockObjectsWithoutExpectationsAttributeRector — also removed from the set

Removals 💀

rector-src
  • [Caching] Drop MemoryCacheStorage, always use FileCacheStorage (#​8354) — completes the cacheClass() deprecation from 2.6.2; only file cache is useful to end users

v2.6.2: Released Rector 2.6.2

Compare 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.

use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withComposerBased(
        doctrine: true,
        phpunit: true,
        twig: true,
    );

Each rule inside checks composer.json/installed.json on its own and runs only if the installed package version matches its constraint. No SymfonySetList::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 --php option on the process command runs only rules bound to a minimal PHP version — those implementing MinPhpVersionInterface. Useful to split a PHP upgrade from the rest, without a second config:

vendor/bin/rector process src --php --dry-run

New features 🥳

  • [Process] Add --php option to run only PHP version rules (#​8322)
  • [Configuration] Resolve the composer-based set of extension packages in withComposerBased() (#​8332), load Doctrine and Twig composer-based sets (#​8313)
  • [Configuration] Report explicit error when the --only rule exists but is not registered in rector.php (#​8300)
  • [DX] Warn on skipped classes that are not Rector rules (#​8323), include the skipped class name in the message (#​8325)
  • [DX] Show previous exceptions during bootstrap (#​8287)
 [WARNING] This skipped class is not a Rector rule, so it can never be skipped.
           Only classes that implement "Rector\Contract\Rector\RectorInterface"
           can be used in "->withSkip()"

New rules 🎉

rector-src

  • [DeadCode] RemoveRedundantTypeCheckRector (#​8307)
 $securityExpression = $operation->getSecurity();
-if (null === $securityExpression || ! is_string($securityExpression)) {
+if (null === $securityExpression) {
     return;
 }

rector-symfony

  • [Configs] EnableValidationAttributesRector (#​1004)
  • [Symfony 2.8] Rename Simple(Pre|Form)AuthenticatorInterface from Core to Http namespace (#​1031)

rector-phpunit

  • [PHPUnit 12.0] AnyMatcherToNewAnyInvokedCountRector for the deprecated any() matcher (#​764)

Bugfixes 🐛

  • [VersionBonding] Cap polyfill rules by the explicitly picked withPhpSets() version (#​8315) — withPhpSets(php82: true) with symfony/polyfill-php83 installed no longer produces PHP 8.3 code
  • [CodeQuality] Skip InlineConstructorDefaultToPropertyRector on non-final class (#​8310) and on a property defined in the parent when parent::__construct() is called (#​8297)
  • [CodeQuality] Skip SimpleXMLElement on IssetOnPropertyObjectToPropertyExistsRector (#​8284)
  • [DeadCode] Skip RemoveParentDelegatingConstructorRector on protected parent constructor (#​8309)
  • [DeadCode] Skip assert() enforcement that produces NeverType on NarrowWideUnionReturnTypeRector (#​8282)
  • [Php71] Skip AssignArrayToStringRector on a variable re-assigned as string (#​8293)
  • [Php81] Skip ArrayToFirstClassCallableRector when the arg type does not accept a Closure (#​8288), drop the Symfony PHP closure check (#​8291)

Set changes 📈

  • [Php84] Remove DeprecatedAnnotationToDeprecatedAttributeRector from the PHP 8.4 set and polyfills (#​8326)
  • [Php83] Remove AddOverrideAttributeToOverriddenMethodsRector from the PHP 8.3 and polyfill sets (#​8321)
  • [CodeQuality] Move 4 early-return rules to the code quality set (#​8301)
  • [DeadCode] Move RemoveReadonlyPropertyVisibilityOnReadonlyClassRector (#​8289), SimplifyBoolIdenticalTrueRector and UnwrapSprintfOneArgumentRector (#​8285) to the dead-code set
  • [rector-symfony] Convert the last version sets to the composer-based set (#​1021), drop per-version composer-triggered sets (#​1010), remove unused version-based set constants and configs (#​1019)
  • [rector-phpunit] Move every per-version rule into the composer-based set (#​758), remove per-version set configs and constants (#​760), register PropertyExistsWithoutAssertRector in the composer-based set (#​761)
  • [rector-symfony] Add JMS attribute rules to the set, bond three attribute rules to package versions (#​1029)

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

  • DeprecatedAnnotationToDeprecatedAttributeRector and ConstAndTraitDeprecatedAttributeRector (#​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)
  • [EarlyReturn] ChangeNestedIfsToEarlyReturnRector (#​8304), ChangeNestedForeachIfsToEarlyContinueRector (#​8303), ReturnBinaryOrToEarlyReturnRector (#​8302), ChangeOrIfContinueToMultiContinueRector (#​8299)
  • [Strict] DisallowedEmptyRuleFixerRector (#​8290)
  • [Php85] NestedFuncCallsToPipeOperatorRector and SequentialAssignmentsToPipeOperatorRector (#​8286)
  • [CodeQuality] SwitchNegatedTernaryRector (#​8283)
  • cacheClass() — the file-vs-memory cache storage choice moved into CacheFactory; only FileCacheStorage is ever useful to end users (#​8311)
  • symfonyRoute and symfonyValidator args in withAttributesSets() (#​8317)
  • ComposerTriggeredSet in favor of ComposerPackageConstraintInterface (#​8296)
  • withComposerBased(netteUtils:) argument (#​8329)

rector-symfony

  • ActionSuffixRemoverRector (#​1022)
  • ControllerMethodInjectionToConstructorRector (#​1020)
  • TraitGetByTypeToInjectRector (#​1002)
  • RemoveDefaultGetBlockPrefixRector (#​1017)
  • SwiftMailer to Symfony Mailer set (#​1026)

rector-doctrine

  • RemoveEmptyTableAttributeRector (#​505)
  • MoveCurrentDateTimeDefaultInEntityToConstructorRector, drop the force_nullable option (#​504)

Removals 💀

  • Drop the nette/utils set and its single UtilsJsonStaticCallNamedArgRector rule (#​8329) — the only third-party-library rule left in rector-src, readability only
  • Remove deprecated NewInInitializerRector (#​8328)
  • [Sets] Remove the PHP and core set providers (#​8320), the Symfony per-version providers (#​8292), SymfonySetProvider, PHPUnitSetProvider (#​8295) and DoctrineSetProvider (#​8298) from the collector
  • [rector-symfony] Remove TwigSetProvider (#​1015) and the empty Symfony per-version set providers (#​1012)
  • [rector-phpunit] Remove deprecated PHPUnitSetProvider (#​759)
  • [rector-doctrine] Remove DoctrineSetProvider (#​501), drop the unused symfony/yaml dependency (#​500)

rectorphp/rector-symfony 🎵

  • [Symfony 7.3] Merge AsTwigFilter/AsTwigFunction rules into a single rule, add getTests() support (#​1027), restore the merged rules as deprecated (#​1028)
  • [CodeQuality] 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)
  • [CodeQuality] LoadValidatorMetadataToAttributeRector: skip non-constant constraint args (#​1000) and constraints without their own constructor (#​1001)
  • [Sets] Fix AddParamTypeDeclaration to nullable types where the upstream param defaults to null (#​1023)
  • [Symfony30] Skip methods without return in GetRequestRector (#​1013), move it to the Symfony 2.5 set (#​1009)
  • [Twig] Fix truncated Twig_Tests_EnvironmentTest_Extension rename (#​1016)

rectorphp/rector-phpunit 🧪

  • [PHPUnit 6.0] AddDoesNotPerformAssertionToNonAssertingTestRector: add the attribute directly and skip traits (#​765), remove addToAssertionCount() calls (#​763), skip Twig IntegrationTestCase children (#​762)

v2.6.1: Released Rector 2.6.1

Compare Source

Bugfix 🐛

  • [composer-based] Fix fatal error in the composer-based command on a lazy-initialized property, e.g. PHPStan UnionType::$normalized (#​8280)
PHP Fatal error:  Uncaught Error: Typed property PHPStan\Type\UnionType::$normalized
must not be accessed before initialization in src/Console/Command/ComposerBasedCommand.php:205

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.

use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withComposerBased(
        doctrine: true,
        netteUtils: true,
        phpunit: true,
        symfony: true,
        twig: true,
    );

The new Twig composer-based set replaces the twig112 → twig127 → ... → twig30 chain with a single set, where every rule checks the installed twig/twig version:

 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) 📦

  • [NetteUtils] Bind nette/utils rules to the installed package version; nette-utils4.php becomes composer-based.php and is loaded as a single set (#​8275)
  • [rector-symfony] Add Twig composer-based set (#​996)
  • [rector-symfony] Bond the remaining 48 Symfony rules to their composer package version (#​994)
  • [rector-symfony] Register LoadValidatorMetadataToAttributeRector in the composer-based set - the last interface-bonded rule left outside it (#​997)
  • [rector-symfony] Bond ContainerInterfaceServiceToServiceContainerRector to symfony/dependency-injection >=6.0 (#​999)
  • [rector-doctrine] Bond AddGetReferenceTypeRector to doctrine/data-fixtures >=1.6 and the annotation-to-attribute sets to their package constraints (#​497)
  • [rector-doctrine] Bond version-specific rules and configuration to composer package constraints (#​495) *
  • [rector-phpunit] Bond RemoveExpectAnyFromMockRector to 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 📈

  • [CodingStyle] Remove ConsistentImplodeRector from the coding style level - the swapped implode($array, $glue) signature was removed in PHP 8.0, so the rule belongs to the php80 set only, where it already is (#​8273)
  • [rector-doctrine] Add DoctrineSetList::COMPOSER_BASED constant, remove the empty DOCTRINE_BUNDLE_210 set (#​499)

Bugfixes 🐛

  • [TypeDeclarationDocblocks] Skip docblock reprint when nothing changed in AddParamArrayDocblockFromAssignsParamToParamReferenceRector (#​8271)
  • [rector-symfony] [Symfony44] Fix duplicated return in ConsoleExecuteReturnIntRector on a trailing comment (#​992), plus a fixture for a block comment with a commented-out return (#​993)
  • [rector-symfony] [Symfony44] Skip redundant (int) cast on a match return in ConsoleExecuteReturnIntRector - a match of int constants is a UnionType, so the instanceof IntegerType check 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 by VariableInStringInterpolationFixerRector in the php82 set.

  • CountArrayToEmptyArrayComparisonRector - also removed from the coding style level (#​8274)
-count($array) === 0;
-count($array) > 0;
+$array === [];
+$array !== [];
  • ArraySpreadInsteadOfArrayMergeRector - the spread result is harder to read, and ... mid-array looks dangerous in review (#​8277)
-$values = array_merge($firstValues, $secondValues);
+$values = [...$firstValues, ...$secondValues];
  • UnusedForeachValueToArrayKeysRector - also removed from the code quality level (#​8278)
-foreach ($values as $key => $value) {
+foreach (array_keys($values) as $key) {
     $items[$key] = null;
 }

rector-doctrine

  • GetRepositoryServiceLocatorToRepositoryServiceInjectionRector - it resolved the repository class by running a regular expression over the entity file contents (#​498)

Renames 🔄

  • [rector-symfony] 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\ContainerInterface and Symfony\...\DependencyInjection\ContainerInterface aliases of the service_container service were removed. Now hardcoded, and the ReplaceServiceArgument value object is gone.

 use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

-return service(ContainerInterface::class);
+return service('service_container');

v2.6.0: Released Rector 2.6.0

Compare 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.json and only runs if the installed package version matches its constraint.

use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withComposerBased(
        doctrine: true,
        phpunit: true,
        symfony: true,
        twig: true,
    );

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:

$rectorConfig->ruleWithConfigurationComposerVersionBound(
    SomeRector::class,
    [...],
    'phpunit/phpunit',
    '>=11.0'
);

To see what is active and why, there is a new command:

vendor/bin/rector composer-based
 Composer package bound rules
 ------------------------------- ----------------- ---------- ----------- --------
  Rule                            Package           Requires   Installed   Active
 ------------------------------- ----------------- ---------- ----------- --------
  RemoveExpectAnyFromMockRector   phpunit/phpunit   >=11.0     11.5.2      yes
  RedirectToRouteRector           symfony/...       >=2.6      7.2.1       yes
 ------------------------------- ----------------- ---------- ----------- --------

 ! [NOTE] 2 of 2 composer package bound items are active

And to run only those rules in a single process:

vendor/bin/rector process --composer-based

New features 🥳

  • [Config] Add ruleWithConfigurationComposerVersionBound() ([#​8244])
  • [composer-based] Add composer-based command ([#​8246])
  • [composer-based] Report rule configuration bound to installed package version ([#​8247])
  • [composer-based] Register each rule only once, add --composer-based process filter ([#​8248])
  • [Configuration] Load single composer-based PHPUnit set in withComposerBased() ([#​8255])
  • [Configuration] Load single composer-based Symfony set in withComposerBased() ([#​8259])
  • [Console] Print composer-based rule configuration on separate full-width line ([#​8256])
  • [Testing] Allow a test case to resolve package versions from a standalone composer.json ([#​8264])

New rules 🎉

rector-src

  • [DeadCode] RemoveTestsOverriddenPrivateMethodParameterRector ([#​8254])

rector-phpunit

  • [CodeQuality] AddIntersectionParamToMockObjectParamRector ([#​755])
  • [PHPUnit 11.0] ExpectsParamToMockObjectRector — for private t

❗ Important

✂ PR body was truncated to here.


Configuration

📅 Schedule: (in timezone Europe/Berlin)

  • Branch creation
    • "before 5am on saturday"
  • 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.

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate Bot added 4. to release dependencies Pull requests that update a dependency file labels Oct 3, 2026
@renovate
renovate Bot enabled auto-merge October 3, 2026 00:29
@renovate
renovate Bot merged commit 3988c2e into master Oct 3, 2026
53 checks passed
@renovate
renovate Bot deleted the renovate/master-rector-rector-2.x branch October 3, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants