UnusedForeachValueToArrayKeysRector

Change foreach with unused $value but only $key, to array_keys()

 class SomeClass
 {
     public function run()
     {
         $items = [];
-        foreach ($values as $key => $value) {
+        foreach (array_keys($values) as $key) {
             $items[$key] = null;
         }
     }
 }

Configure your rector.php:

<?php

use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withRules([
        UnusedForeachValueToArrayKeysRector::class,
    ]);
SETS:  Code Quality