CompletePropertyDocblockFromToManyRector

Improve Doctrine property @var collections type to make them useful both for PHPStan and PHPStorm

 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;

 /**
  * @ORM\Entity
  */
 class SomeClass
 {
     /**
      * @ORM\OneToMany(targetEntity=Trainer::class, mappedBy="trainer")
-     * @var Collection|Trainer[]
+     * @var Collection<int, Trainer>
      */
     private $trainings = [];

     public function setTrainings($trainings)
     {
         $this->trainings = $trainings;
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Doctrine\TypedCollections\Rector\Class_\CompletePropertyDocblockFromToManyRector;

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