SimplifyForeachToCoalescingRector

Changes foreach that returns set value to ??

-foreach ($this->oldToNewFunctions as $oldFunction => $newFunction) {
-    if ($currentFunction === $oldFunction) {
-        return $newFunction;
-    }
-}
-
-return null;
+return $this->oldToNewFunctions[$currentFunction] ?? null;

Configure your rector.php:

<?php

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

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