[NetteUtils] Bind nette/utils rules to installed package version - #8275
Merged
Conversation
Same approach as rectorphp/rector-symfony#979: rules declare their own composer package constraint, the set is triggered by any installed nette/utils version.
…d(), drop nette-utils set group
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.
Follows the approach of rectorphp/rector-symfony#979 for nette/utils.
Rules bound to a nette/utils version now declare the constraint themselves via
ComposerPackageConstraintInterface, instead of relying on the version-named set they live in:The
bool $pretty/bool $forceArraysparams exist from nette/utils 4.0; before that both methods tookint $flags, so the named args would produce broken code.The
nette-utils4.phpset becomescomposer-based.php, registered as a single set - same as PHPUnit and Symfony - as every rule inside is bound to the installed nette/utils version on its own:if ($symfony) { // single set, as every rule inside is bound to the installed Symfony package version on its own $this->sets[] = SymfonySetList::COMPOSER_BASED; } + + if ($netteUtils) { + // single set, as every rule inside is bound to the installed nette/utils version on its own + $this->sets[] = SetList::NETTE_UTILS_COMPOSER_BASED; + }With that, the
ComposerTriggeredSetinCoreSetProviderand the now unusedSetGroup::NETTE_UTILSgroup are dropped.Side effect: the rule is also part of
named-args.php, a plain set with no composer trigger. There it now skips itself on nette/utils 3 and lower, where it used to produce broken code:Verified with
withComposerBased(netteUtils: true):