Remove unused key in foreach
$items = [];
-foreach ($items as $key => $value) {
+foreach ($items as $value) {
$result = $value;
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
return RectorConfig::configure()
->withRules([
RemoveUnusedForeachKeyRector::class,
]);