[Sets] Drop per-version composer-triggered sets already covered by composer-based set - #1010
Merged
Merged
Conversation
…mposer-based set Every rule in the per-version composer-triggered sets is already registered in composer-based.php, where it carries its own package version constraint. Keeping both meant the same rules were loaded twice, from two sources of truth. Only the composer-based set stays composer-triggered. The trigger package list is re-derived from composer-based.php itself, which fixes gates that sat above the version their rules actually need (framework-bundle 3.3 -> 2.5, form and validator 3.0 -> 2.5, yaml 3.1 -> 2.8, routing 6.0 -> 3.4, twig-bridge 6.2 -> 6.1, messenger 6.3 -> 6.2) and adds four packages that had no trigger at all (var-dumper, intl, uid, filesystem). The per-version set files stay in place and reachable through SymfonySetList and TwigSetList constants. Symfony3-8SetProvider keep empty provide(), since rector-src instantiates them by name.
Every rule inside the set already declares the package and version it needs, so the 52-entry trigger package list only duplicated that information one level up - and each new package had to be added there by hand or its rules would never run. The set is now a plain Set, listed as "Composer Based".
The composer-based set is reachable through SymfonySetList::COMPOSER_BASED, which is what withComposerBased(symfony: true) uses, and the remaining sets through their SymfonySetList constants. The provider only listed them a second time.
TomasVotruba
added a commit
to rectorphp/rector-src
that referenced
this pull request
Aug 5, 2026
Symfony3SetProvider to Symfony8SetProvider only registered composer-triggered sets that the Symfony composer-based set already covers, rule for rule. rector-symfony empties them in rectorphp/rector-symfony#1010, so the collector can stop asking them for sets. SymfonySetProvider and TwigSetProvider stay, as they carry the composer-based sets.
TomasVotruba
added a commit
to rectorphp/rector-src
that referenced
this pull request
Aug 5, 2026
rectorphp/rector-symfony#1010 trims TwigSetProvider to its composer-based trigger, as every rule of the per-version Twig sets is already in it, bound to the twig/twig version it needs.
This was referenced Aug 5, 2026
[Php71] Skip AssignArrayToStringRector on a variable re-assigned as string
rectorphp/rector-src#8293
Merged
TomasVotruba
added a commit
to rectorphp/rector-src
that referenced
this pull request
Aug 5, 2026
…traintInterface A set triggered on a single major version has to be repeated for every version an upgrade passes through. A rule bonded with ComposerPackageConstraintInterface, added in #7877, states the exact package version its target API is available from and applies from there upwards, so one set covers every upgrade path. rectorphp/rector-symfony#1010 and rectorphp/rector-phpunit#758 moved both extensions over, leaving Twig as the only remaining user. The internal resolving of the class is kept working and ignored in phpstan.neon until that lands too.
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.
The Symfony sets were registered twice: once per version as
ComposerTriggeredSets, once ascomposer-based.php. I verified the overlap mechanically — across all 208 triggered sets inSymfony3SetProvider–Symfony8SetProviderandTwigSetProvider, 0 rules were missing from the matching composer-based set. Every one of them was a duplicate.So the per-version registrations go, and only the composer-based sets stay.
final class Symfony8SetProvider implements SetProviderInterface { public function provide(): array { - return [ - new ComposerTriggeredSet( - SetGroup::SYMFONY, - 'symfony/uid', - '8.1', - __DIR__ . '/../../../config/sets/symfony/symfony8/symfony81/symfony81-uid.php' - ), - // ... 5 more - ]; + return []; } }The trigger package list goes too
SymfonySetProvidergatedcomposer-based.phpbehind a hand-maintained list of 52 packages and versions. That list duplicated, one level up, what each rule already declares for itself:It had also drifted. Seven packages were gated above the version their rules need —
symfony/framework-bundleat>=3.3where a rule needs 2.5,symfony/routingat>=6.0where a rule needs 3.4, and so on — and four packages with rules in the set (var-dumper,intl,uid,filesystem) had no entry at all. Every drift like that silently disables rules.With nothing left to trigger,
SymfonySetProvidergoes as well. This changes nothing for users:withComposerBased(symfony: true)already addsSymfonySetList::COMPOSER_BASEDdirectly rather than going throughSetGroup::SYMFONY, exactly as it does for PHPUnit. The remaining Symfony sets — Configs, Code Quality, Constructor Injection, SwiftMailer and the attribute sets — stay reachable through theirSymfonySetListconstants.rectorphp/rector-src#8292 drops the matching
new SymfonySetProvider()fromSetProviderCollector.TwigSetProviderkeeps its singletwig/twig >=1.12trigger, sinceSetGroup::TWIGis wired intowithComposerBased().Kept on purpose
SymfonySetList::SYMFONY_*/TwigSetList::TWIG_*.Symfony3SetProvider–Symfony8SetProviderstay as classes with an emptyprovide()until [Sets] Drop Symfony per-version set providers from the collector rector-src#8292 lands, sinceSetProviderCollectorstill instantiates them by name. They can be deleted right after.Left to migrate
Still outside the composer-based encoding, all plain opt-in sets with no version binding:
Configs,Code Quality,Constructor InjectionSwiftMailer to Symfony MailerAnd the 209 per-version set files under
config/sets/symfony/symfony3..8/andconfig/sets/twig/, now reachable only through the set list constants.