Make use of array_key_first() and array_key_last()
-reset($items);
-$firstKey = key($items);
+$firstKey = array_key_first($items);
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector;
return RectorConfig::configure()
->withRules([
ArrayKeyFirstLastRector::class,
]);