Narrow ArrayCollection to Collection in class method and property
use Doctrine\Common\Collections\ArrayCollection;
final class ArrayCollectionGeneric
{
/**
- * @return ArrayCollection<int, string>
+ * @return \Doctrine\Common\Collections\Collection<int, string>
*/
public function someMethod()
{
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Doctrine\TypedCollections\Rector\ClassMethod\NarrowArrayCollectionToCollectionRector;
return RectorConfig::configure()
->withRules([
NarrowArrayCollectionToCollectionRector::class,
]);