Run Rector on your code to see what it can do for you:

 {
     private function doSomething($values): void
     {
-        $values[array_key_last($values)]['label']['show'] = true;
+        array_last($values)['label']['show'] = true;
     }
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: e040c5 - released at 2026-01-11 00:45