Try Rector
Documentation
Find Rule
Blog
Codebase Audit
Contact
Try Rector
Documentation
Find Rule
Blog
Codebase Audit
Contact
Hire Upgrade Team
Hire Team
Try Rector online
Rector 2.6.6 (hash
0c2c04
) · from 2026-09-14
Your PHP code
Run Rector
<?php final class DemoFile { public function run(bool $param) { if ($this->isTrue($param)) { return 5; } return '10'; } private function isTrue($value) { return $value === true; } }
Run Rector to see the suggested changes here.
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