Applies type hints to array_map closures
-array_reduce($strings, function ($carry, $value, $key): string {
+array_reduce($strings, function (string $carry, string $value): string {
return $carry . $value;
}, $initialString);
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\FunctionLike\AddClosureParamTypeForArrayReduceRector;
return RectorConfig::configure()
->withRules([
AddClosureParamTypeForArrayReduceRector::class,
]);