[composer-based] Bond remaining 48 Symfony rules to their composer package version - #994
Merged
Merged
Conversation
…ckage version Every rule that was only reachable through a per-version set now declares the package and version its target API was added in, and is registered in the composer-based set as well. The per-version sets are left untouched. Rules bonded to a package that is not installed here, or installed below the bonded version, get a standalone composer.json in their test config, following the RedirectToRouteRector precedent.
…to symfony/twig-bridge 6.1 The rule already gates on PHP 8.1 for the first-class callable syntax it produces. The composer constraint pins the matching Symfony side: the first-class callable style in Twig extensions landed in symfony/twig-bridge 6.1, which itself requires PHP 8.1, so both gates open together.
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.
Follow-up to #991. Every remaining Symfony rule that lived only in a per-version set now declares the package and version its target API was added in, and is registered in the composer-based set too.
The per-version sets are not touched — every rule stays exactly where it was registered.
What a bonded rule looks like
Effect for the user: on a project without
symfony/intl, or with it below 4.3, the rule is skipped instead of firing on unrelated code.The set
config/sets/symfony/composer-based.phpgoes from 23 to 71 rules. The list is rebuilt version-sorted and grouped per package, non-Symfony packages last:The blanket
// symfony/* 5.2and// attributes added in Symfony 6.2comments are replaced by the exact package + version per group, read back from each rule's own constraint.Test composer.json stubs
48 rule tests get a standalone
config/composer.jsonand aprovideComposerJsonFilePath()override, following theRedirectToRouteRectorprecedent from #991:{ "require": { "symfony/intl": "^4.3" } }Needed because the bonded package is either not installed here at all (
symfony/form,symfony/intl,symfony/messenger,symfony/framework-bundle,symfony/doctrine-bridge,symfony/twig-bundle,symfony/twig-bridge,symfony/uid,twig/twig), or installed below the bonded version — the 8.1 constraints onsymfony/uid,symfony/security-http,symfony/filesystemandsymfony/validatorcannot coexist with the 6.4/7.4 dev dependencies. Norequire-devversions are changed.Judgement calls worth a look
symfony34-sensio-framework-extra-bundleare bonded tosymfony/routing >=3.4, not tosensio/framework-extra-bundle— Sensio's own versions do not track Symfony's, and the target API is Symfony'sRouteannotation.GetFiltersToAsTwigFilterAttributeRectorandGetFunctionsToAsTwigFunctionAttributeRectorare bonded totwig/twig >=3.21, whereTwig\Attribute\AsTwigFilter/AsTwigFunctionlanded.MagicClosureTwigExtensionToNativeMethodsRectoris bonded tosymfony/twig-bridge >=6.1. It already gates on PHP 8.1 throughMinPhpVersionInterfacefor the first-class callable syntax it produces; 6.1 is where symfony/twig-bridge adopted that style inCodeExtension, and Symfony 6.1 requires PHP 8.1, so both gates open together.Still unregistered anywhere (pre-existing, untouched)
InvokableCommandInputAttributeRector,SimplifyFormRenderingRector,WebTestCaseAssertIsSuccessfulRector,WebTestCaseAssertResponseCodeRectorare in no set at all. Separate PR.