Add return type based on strict parameter type
class SomeClass
{
- public function resolve(ParamType $item)
+ public function resolve(ParamType $item): ParamType
{
return $item;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector;
return RectorConfig::configure()
->withRules([
ReturnTypeFromStrictParamRector::class,
]);