WhileEachToForeachRector

each() function is deprecated, use foreach() instead.

-while (list($key, $callback) = each($callbacks)) {
+foreach ($callbacks as $key => $callback) {
     // ...
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Php72\Rector\While_\WhileEachToForeachRector;

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