Skip to content

Add Pest 2 to 5 upgrade rules with composer-based set - #1

Merged
TomasVotruba merged 3 commits into
mainfrom
pest-upgrade-rules
Dec 3, 2026
Merged

TomasVotruba merged 3 commits into
mainfrom
pest-upgrade-rules

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Rules based on the Pest upgrade guide and API diff of Pest source (v2.36 - v5.3.7), see /blueprint.

Single PestSetList::COMPOSER_BASED set, inspired by rector-phpunit. Each rule implements ComposerPackageConstraintInterface and is bound to the pestphp/pest version its target API exists in, so no per-version sets are needed.

Rule Change Pest
TapToDeferRector it()->tap() to ->defer(), tap() removed in 3.0 >=2.0
ExpectObjectToHaveMethodToClassRector expect($object)->toHaveMethod() to expect($object::class), only for known object types >=3.0
ThemeToPrinterRector pest()->theme() to pest()->printer(), renamed in 3.0.3 >=3.0.3
UsesCompactToPrinterCompactRector deprecated uses()->compact() to pest()->printer()->compact() >=3.0.3
RemoveCoversNothingRector remove ->coversNothing(), dropped in 4.0 with PHPUnit 12 >=4.0

Pest 4 to 5 has no removed or renamed public API, so no Pest 5 bound rule.

tests/ComposerBased covers the whole set on Pest 5, tests/ComposerBasedPest3 checks the 4.0 rule is skipped on Pest 3.

Also adds tooling mirrored from rector-phpunit: ECS, PHPStan, Rector, class-leak, CI workflow.

@TomasVotruba TomasVotruba changed the title Add Pest 3 and Pest 4 upgrade rules Add Pest 2 to 5 upgrade rules with composer-based set Dec 3, 2026
@TomasVotruba
TomasVotruba merged commit 752b83e into main Dec 3, 2026
7 checks passed
@TomasVotruba
TomasVotruba deleted the pest-upgrade-rules branch December 3, 2026 18:13
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