About Rector
Hire Team
Try Rector
Contact
Blog
Docs
Run Rector on your code to see what it can do for you:
<?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\Set\ValueObject\SetList; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; return static function (RectorConfig $rectorConfig): void { // A. run whole set $rectorConfig->sets([ SetList::TYPE_DECLARATION, ]); // B. or single rule $rectorConfig->rule(TypedPropertyFromAssignsRector::class); };
Process
Rector version:
d7710f
- released at 2023-10-03 09:39