CurrentOnCollectionToArrayRector

Change current() on Collection typed property to ->toArray() call, to always provide an array

 use Doctrine\Common\Collections\Collection;

 final class SimpleClass
 {
     /**
      * @var Collection<int, string>
      */
     public $items;

     public function merge()
     {
-        return current($this->items);
+        return current($this->items->toArray());
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Doctrine\TypedCollections\Rector\FuncCall\CurrentOnCollectionToArrayRector;

return RectorConfig::configure()
    ->withRules([
        CurrentOnCollectionToArrayRector::class,
    ]);