Add strict return array type based on created empty array and returned
final class SomeClass
{
- public function run()
+ public function run(): array
{
$values = [];
return $values;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector;
return RectorConfig::configure()
->withRules([
ReturnTypeFromStrictNewArrayRector::class,
]);