Repository navigation
chore(rector): support PHPUnit sets of rector 1.x and 2.x - #102
Merged
Merged
Conversation
Rector 2.x removed the PHPUNIT_40 to PHPUNIT_110 set constants, so `make rector` failed with an undefined constant after `composer update`. Use `withPreparedSets(phpunitCodeQuality: true)`, which exists in both majors, and `withComposerBased(phpunit: true)` where available, falling back to the version constants on rector 1.x. 🤖 Generated with Claude Code
Code coverage overviewLanguages: PHP PHP / code-coverage/phpunit
View coverage of the 6 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
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.
make rectorfailed aftercomposer updatebecause rector 2.x removed thePHPUnitSetList::PHPUNIT_40toPHPUNIT_110constants.rector.phpnow loads on rector 1.2.10 and 2.x.Verified:
make itpasses on rector 2.8.4, andrector process --dry-runruns on a full--prefer-lowestinstall (rector 1.2.10, phpstan 1.12.17).Rector 2.8.4 wants to change 55 files in src and tests, none included here
It mostly adds
@see \MLL\Utils\Tests\...Testdocblocks to classes from the PHPUnit code quality set.On rector 1.2.10 the dry run wants 3 files, for example
assertEqualstoassertSame.Both are separate cleanups, so this PR only changes
rector.php.Both majors are kept because rector 1.x has no `withComposerBased`
withPreparedSets(phpunitCodeQuality: true)exists in both majors.withComposerBased(phpunit: true)exists from 2.0.9 and picks the sets from the installed PHPUnit.On 1.x the config falls back to the version constants, behind a
TODO.Raising the constraint to
^2.0.9would also force phpstan^2in the lowest-deps run, which this fix does not need.CI does not run rector, it only installs it, so this config is exercised locally.
For agents 🤖: ready for review, nothing pending
Draft, no reviewers. Rector 2.8.4 also warns that the
JoinStringConcatRectorskip inrector.phpis deprecated and never registered. Left untouched.