DefaultCollectionKeyRector

Add default key to Collection generic type if missing in @param or @return of class method

 use Doctrine\Common\Collections\Collection;

 final class ReturnSimpleCollection
 {
     /**
-     * @return Collection<string>
+     * @return Collection<int, string>
      */
     public function someMethod()
     {
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Doctrine\TypedCollections\Rector\ClassMethod\DefaultCollectionKeyRector;

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