Skip to content

chore(deps): update dependency rector/rector to ~2.7.0 - #69

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

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

Conversation

@renovate

@renovate renovate Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
rector/rector (source) ~2.6.3 → ~2.7.0 age confidence

Release Notes

rectorphp/rector (rector/rector)

v2.7.0: Released Rector 2.7

Compare Source

New Rules ✨

  • Add TernaryToNullsafeCoalesceRector (#​8499)
  • Add BoolReturnTypeFromBooleanConstAndStrictReturnsRector for mixed const + strict bool returns (#​8498)
  • Add ConstructorReadonlyAssignToDefaultRector for readonly property defaults (#​8502)
  • Add RemoveOverriddenAssignBeforeIfElseRector (#​8505)

Performance Improvements 🚀

  • Cache class-like name resolution per file version in ShortNameResolver, so name import no longer rescans the whole file for every name - up to ~24 % fewer CPU instructions on large projects (#​8524)
  • Cache dry-run files whose FileDiff has no content change (#​8523)
  • Key the file cache on project-relative paths, so a cache survives a change of checkout (#​8490)
  • Use FileSystem::writeAtomic() in FileCacheStorage to avoid partial cache reads on parallel runs (#​8520)
  • Terminate timed-out and unconnected workers (#​8522)
  • Fix silently skipped files when the only worker is respawned (#​8521)
  • Give the worker the same NDJSON frame limit as the main process (#​8489)
  • Bump to PHPStan 2.3

Bugfixes 🐛

  • RenamePropertyRector: rename the property both in the trait and in the class property itself (#​8518)
  • RenameClassRector: throw on same old and new class in the configuration (#​8515)
  • ScalarParamTypeByMethodCallTypeRector: skip string param inference to avoid unsafe scalar coercion (#​8514)
  • RepeatedAndNotEqualToNotInArrayRector / RepeatedOrEqualToInArrayRector: skip short-circuit dependent values (#​8516)
  • SeparateMultiUseImportsRector: keep trait use adaptations (#​8510)
  • Privatize*Rector: drop the final flag when changing protected to private, since private final is forbidden on PHP 8.4 (#​8509)
  • AddNameToBooleanArgumentRector / AddNameToNullArgumentRector: skip callees marked @no-named-arguments (#​8508)
  • TypedPropertyFromStrictConstructorRector: skip a protected property redeclared in a child class (#​8503)
  • RemoveAlwaysTrueIfConditionRector: skip a maybe-undefined variable (#​8501)
  • SingularSwitchToIfRector: skip nested break/continue in the case body (#​8500)
  • TypeDeclaration: skip redundant intersection types in union return types (#​8527)
  • Naming: keep mass nouns ending in data/info untouched when singularizing (#​8492)

rector-doctrine 🟠

  • Add DoctrineQueryBuilderSortDirectionRector (#​524)
  • Add DoctrineOrderByAttributeSortDirectionRector (#​525)
  • Register the SortDirection rules in the composer-based set and cover Expr\OrderBy::add() (#​530)
  • CorrectDefaultTypesOnEntityPropertyRector: support properties initialized as int (#​526)

rector-symfony 🎵

  • GetRequestRector: reuse an existing untyped $request param (#​1066)
  • CommandConfigureToAttributeRector: do not report a change when nothing is extracted (#​1068)
  • Fix PhpAstExtractor import removal in the composer-based Symfony set (#​1070)

rector-phpunit 🟢

  • Add WillReturnCallbackFallbackToReturnFalseRector (#​784)
  • Extend FlipAssertRector to more assert methods and expected value shapes (#​787)
  • AllowMockObjectsForDataProviderRector: skip stub-only ->method() calls (#​790)
  • Fix changing keys of data providers for tests with optional arguments (#​783)
  • Deprecate ConfiguredMockEntityToSetterObjectRector as experimental (#​789)

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)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants