Rector 2.6.2 completes the move to composer-based sets that began in version 2.6.0. Rules can now check composer.json and installed.json to see which package versions an app uses. The release was tagged on August 12, 2026.

  • Every extension package now ships a single composer-based set
  • The per-version set providers for PHP, Symfony, PHPUnit, Doctrine, and Twig have been removed
  • A new --php option on process runs only the rules bound to a minimum PHP version
  • Several rules are now deprecated and no longer change code
  • The nette/utils set has been removed

What's New

Composer-Based Sets

The new configuration uses one call with an option for each package:

use Rector\Config\RectorConfig;

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

Each rule has its own version limit. It runs only when the installed package matches that limit. This replaces settings such as SymfonySetList::SYMFONY_63 and removes the need to choose a PHPUnit version by hand.

The change also covers Rector's extension packages. Rector Symfony converted its last version sets (#1021) and removed its per-version composer sets (#1010). Rector PHPUnit moved each per-version rule into its composer-based set (#758). Doctrine and Twig sets now load through withComposerBased() too.

The release notes say work on the Drupal and Laravel community packages is still underway.

PR: #8332, #8313

Run Only the PHP Rules

A new --php option runs only rules tied to a minimum PHP version. These are rules that implement MinPhpVersionInterface:

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

This lets teams separate a PHP upgrade from other code changes without creating a second config file. For example, PHP 8.1 to 8.3 changes can go into one pull request, while code-quality changes go into another.

PR: #8322

Clearer Configuration Errors

Rector now reports two configuration mistakes more clearly. If --only names a rule that is not registered in rector.php, Rector shows an error instead of running no rules. It also warns when withSkip() contains a class that is not a Rector rule:

 [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()"

PR: #8300, #8323, #8325

New Rules

RemoveRedundantTypeCheckRector drops a type check the surrounding condition already guarantees:

 $securityExpression = $operation->getSecurity();
- if (null === $securityExpression || ! is_string($securityExpression)) {
+ if (null === $securityExpression) {
     return;
 }

Rector Symfony adds EnableValidationAttributesRector (#1004). It also adds a rule that moves Simple(Pre|Form)AuthenticatorInterface from the Core namespace to Http (#1031).

Rector PHPUnit adds AnyMatcherToNewAnyInvokedCountRector for PHPUnit's deprecated any() matcher (#764).

PR: #8307

PHP Polyfill Version Fix

Rector could produce PHP 8.3 code when a config used withPhpSets(php82: true) but the project had symfony/polyfill-php83 installed. Polyfill rules now follow the PHP version chosen in the Rector config.

PR: #8315

Upgrade Notes

This release removes several set providers and rules. Projects using them will need to update their Rector config.

Removed providers include PHP and core (#8320), Symfony per-version providers (#8292), SymfonySetProvider, PHPUnitSetProvider (#8295), DoctrineSetProvider (#8298), and TwigSetProvider (#1015). Rector Symfony also removed old version-based constants and config files (#1019). Check rector.php for these names before upgrading.

The nette/utils set and UtilsJsonStaticCallNamedArgRector rule were removed (#8329). The deprecated NewInInitializerRector was also removed (#8328).

Deprecated rules now print a warning but do not change code. This means a rule may stop making changes before it is removed in a future major release. The list includes CoalesceToTernaryRector, JsonThrowOnErrorRector, PropertyHookRector, four early-return rules, and two PHP 8.5 pipe-operator rules.

Several config options are also deprecated. They include cacheClass(), the symfonyRoute and symfonyValidator options in withAttributesSets(), ComposerTriggeredSet, and the netteUtils option in withComposerBased().

Install or update Rector with Composer:

composer require rector/rector --dev

Run Rector with --dry-run after the update and review the changes before writing them to the project.

References