Make use of array_key_first() and array_key_last() instead of reading a single key off array_keys()
-$firstKey = current(array_keys($items));
-$lastKey = end(array_keys($items));
+$firstKey = array_key_first($items);
+$lastKey = array_key_last($items);
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\Php73\Rector\FuncCall\ArrayKeysToArrayKeyFirstLastRector;
return RectorConfig::configure()
->withRules([
ArrayKeysToArrayKeyFirstLastRector::class,
]);