ReplaceEachAssignmentWithKeyCurrentRector

Replace each() assign outside loop

 $array = ['b' => 1, 'a' => 2];

-$eachedArray = each($array);
+$eachedArray[1] = current($array);
+$eachedArray['value'] = current($array);
+$eachedArray[0] = key($array);
+$eachedArray['key'] = key($array);
+
+next($array);

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Php72\Rector\Assign\ReplaceEachAssignmentWithKeyCurrentRector;

return RectorConfig::configure()
    ->withRules([
        ReplaceEachAssignmentWithKeyCurrentRector::class,
    ]);
SETS:  PHP 7.2