Add int/float return type based on strict scalar returns type
class SomeClass
{
- public function getNumber()
+ public function getNumber(): int
{
return 200;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\NumericReturnTypeFromStrictScalarReturnsRector;
return RectorConfig::configure()
->withRules([
NumericReturnTypeFromStrictScalarReturnsRector::class,
]);