Add return type from strict return type of call
final class SomeClass
{
- public function getData()
+ public function getData(): int
{
return $this->getNumber();
}
private function getNumber(): int
{
return 1000;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector;
return RectorConfig::configure()
->withRules([
ReturnTypeFromStrictTypedCallRector::class,
]);