Add return type to function like with return new
final class SomeClass
{
- public function create()
+ public function create(): Project
{
return new Project();
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
return RectorConfig::configure()
->withRules([
ReturnTypeFromReturnNewRector::class,
]);