Try Rector
Docs
Hire Team
Find Rule
Blog
Contact
AST
Try Rector
Docs
Hire Team
Find Rule
Blog
Contact
AST
Run Rector on your code to see what it can do for you:
// no change
PHP snippet to change
<?php abstract class BaseClass { } final class DemoFile extends Base { public function run(bool $param) { echo "hello, world!"; } }
Config
rector.php
<?php declare(strict_types=1); use Rector\Config\RectorConfig; use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector; use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration; use PHPStan\Type\VoidType; return RectorConfig::configure() ->withConfiguredRule(AddReturnTypeDeclarationRector::class, [ new AddReturnTypeDeclaration('BaseClass', 'run', new VoidType()), ]);
Run Rector
Rector version:
bb32c6
- released at 2026-01-07 13:03