Skip to content

[composer-based] Include all configured rules in the composer-based set - #980

Merged
TomasVotruba merged 1 commit into
mainfrom
composer-based-configured-rules
Aug 1, 2026
Merged

[composer-based] Include all configured rules in the composer-based set#980
TomasVotruba merged 1 commit into
mainfrom
composer-based-configured-rules

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Follow-up to #979, which bonded the standalone rules. This adds the configured ones, the same way rector-phpunit #754 does.

What

Every ruleWithConfiguration() call of the composer triggered Symfony version sets is now also registered in config/sets/symfony/composer-based.php through ruleWithConfigurationComposerVersionBound(), bound to the package and version of the set it came from:

// symfony/console 5.3
$rectorConfig->ruleWithConfigurationComposerVersionBound(RenameMethodRector::class, [
    new MethodCallRename('Symfony\Component\Console\Helper\Helper', 'strlen', 'width'),
], 'symfony/console', '>=5.3');

162 configurations, from symfony/class-loader 3.0 up to symfony/json-streamer 7.4 - renames, argument changes, type declarations, annotation to attribute conversions.

Effect

The configuration applies to any project with that package version installed, no matter which Symfony version the upgrade started from:

 public function run(Helper $helper, Request $request)
 {
-    $width = $helper->strlen('some text');
-    $contentType = $request->getContentType();
+    $width = $helper->width('some text');
+    $contentType = $request->getContentTypeFormat();
 }

Both renames land in one run, from a project that never enabled the symfony53 or symfony62 set.

Notes

  • Existing sets stay untouched, composer.json too.
  • Trigger packages of the set grew to 48, one per package used inside, each from the lowest version its configuration requires.
  • Shared type variables of the source sets ($arrayType, $scalarArrayObjectUnionType, ...) are defined once at the top of the set.
  • New tests/ComposerBased smoke test loads the whole set and checks two version-bound renames land.

Every ruleWithConfiguration() call of the composer triggered Symfony version
sets is now also registered here through
ruleWithConfigurationComposerVersionBound(), bound to the package and version
of the set it comes from.

That way a rename, argument or type declaration configuration applies to any
project with that package version installed, no matter which version the
upgrade started from.

Adds a ComposerBasedTest smoke test over the whole set.
@TomasVotruba
TomasVotruba merged commit 8cd9763 into main Aug 1, 2026
7 checks passed
@TomasVotruba
TomasVotruba deleted the composer-based-configured-rules branch August 1, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant