Add return type from return direct array
final class AddReturnArray
{
- public function getArray()
+ public function getArray(): array
{
return [1, 2, 3];
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnDirectArrayRector;
return RectorConfig::configure()
->withRules([
ReturnTypeFromReturnDirectArrayRector::class,
]);