ArrayMergeOnCollectionToArrayRector

Change array_merge() on Collection to ->toArray()

 use Doctrine\Common\Collections\Collection;

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

     public function merge()
     {
-        return array_merge([], $this->items);
+        return array_merge([], $this->items->toArray());
     }
 }

Configure your rector.php:

<?php

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

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