rector / rector-pest
Rector upgrades rules for Pest
dev-main
2026-12-03 18:13 UTC
Requires
- php: >=8.4
Requires (Dev)
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.2
- phpstan/phpstan-webmozart-assert: ^2.0
- phpunit/phpunit: ^13.2
- rector/rector-src: dev-main
- rector/swiss-knife: ^2.6
- symplify/easy-coding-standard: ^13.2
- symplify/phpstan-extensions: ^12.0
- symplify/phpstan-rules: ^14.13.1
- tomasvotruba/class-leak: ^2.1
Suggests
None
Provides
None
Conflicts
- rector/rector: <2.0
Replaces
None
This package is auto-updated.
Last update: 2026-12-03 18:18:01 UTC
README
Upgrade your Pest test suite from Pest 2 to the latest version.
Install
composer require rector/rector-pest --dev
Use Sets
Enable the composer-based Pest set in your config. Each rule is bound to the pestphp/pest version installed in your project, so it is applied only once its target API exists:
use Rector\Config\RectorConfig; return RectorConfig::configure() ->withComposerBased(pest: true);
| Rule | Change | Pest |
|---|---|---|
TapToDeferRector |
tap() to defer() in high order tests |
>=2.0 |
ExpectObjectToHaveMethodToClassRector |
object to class name in toHaveMethod()/toHaveMethods() |
>=3.0 |
ThemeToPrinterRector |
pest()->theme() to pest()->printer() |
>=3.0.3 |
UsesCompactToPrinterCompactRector |
deprecated uses()->compact() to pest()->printer()->compact() |
>=3.0.3 |
RemoveCoversNothingRector |
remove ->coversNothing(), dropped with PHPUnit 12 |
>=4.0 |
Pest 5 has no code-level changes, only dependency and PHPUnit 13 updates.
Blueprint
The /blueprint directory contains the Pest upgrade guide and Pest release notes from 2.x onwards, used as the source for these rules.