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:
// 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:
a01724
- released at 2026-06-11 23:36