Skip to content

chore(rector): support PHPUnit sets of rector 1.x and 2.x - #102

Merged
spawnia merged 1 commit into
masterfrom
fix-rector-phpunit-sets
Nov 4, 2026
Merged

spawnia merged 1 commit into
masterfrom
fix-rector-phpunit-sets

Conversation

@spawnia

@spawnia spawnia commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

make rector failed after composer update because rector 2.x removed the PHPUnitSetList::PHPUNIT_40 to PHPUNIT_110 constants.
rector.php now loads on rector 1.2.10 and 2.x.

Verified: make it passes on rector 2.8.4, and rector process --dry-run runs on a full --prefer-lowest install (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\...Test docblocks to classes from the PHPUnit code quality set.
On rector 1.2.10 the dry run wants 3 files, for example assertEquals to assertSame.
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.9 would also force phpstan ^2 in 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 JoinStringConcatRector skip in rector.php is deprecated and never registered. Left untouched.

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
@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: PHP

PHP / code-coverage/phpunit

master 2949ba3 fix-rector-phpunit-s... 72ec143 +/-
89% 90% +1%
View coverage of the 6 most impacted files.
File master 2949ba3 fix-rector-phpunit-s... 72ec143 +/-
IlluminaSampleS...ingsSection.php 100% 100% 0%
InterOp/RunResult.php 100% 100% 0%
CSVArray.php 90% 96% +6%
PHPStan/Rules/M...ypehintRule.php 0% 88% +88%
PHPStan/Rules/M...ypehintRule.php 0% 100% +100%
PHPStan/Rules/C...ypehintRule.php 0% 100% +100%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@spawnia
spawnia marked this pull request as ready for review November 4, 2026 15:29
@spawnia
spawnia merged commit e3323c1 into master Nov 4, 2026
30 checks passed
@spawnia
spawnia deleted the fix-rector-phpunit-sets branch November 4, 2026 15:30
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 7.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant