Narrow union type to Collection type in property docblock and native type declaration
use Doctrine\Common\Collections\Collection;
class SomeClass
{
/**
- * @var Collection|array
+ * @var Collection
*/
private $property;
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Doctrine\TypedCollections\Rector\Property\NarrowPropertyUnionToCollectionRector;
return RectorConfig::configure()
->withRules([
NarrowPropertyUnionToCollectionRector::class,
]);