Try Rector
Documentation
Hire Team
Blog
Contact
Try Rector
Documentation
Hire Team
Blog
Contact
Run Rector on your code to see what it can do for you:
PHP snippet to change
<?php final class DemoFile { public function run(bool $param) { if ($this->isTrue($param)) { return 5; } return '10'; } private function isTrue($value) { return $value === true; } }
Config
rector.php
<?php use Rector\Config\RectorConfig; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\ValueObject\PhpVersion; return RectorConfig::configure() // A. whole set ->withPreparedSets(typeDeclarations: true) // B. or few rules ->withRules([ TypedPropertyFromAssignsRector::class ]) // demonstrate specific PHP version ->withPhpVersion(PhpVersion::PHP_84);
Run Rector
Rector version:
78e99a
- released at 2026-06-05 21:27