I receive an error from PHPStan:
Property App\Entity\Product::$productArticles type mapping mismatch: property can contain Doctrine\Common\Collections\Collection but database
expects Doctrine\Common\Collections\Collection&iterable<App\Entity\ProductArticle>
My variable declaration:
#[ORM\OneToMany(mappedBy: 'product', targetEntity: ProductArticle::class)]
/** @var Collection<int, ProductArticle> */
private Collection $productArticles;
How can I use both: annotation to declare variable for ORM and PHPDoc comment to declare Collection type?
@var Collection<int, ProductArticle>?@ORM\OneToMany. And you want working code or to look pretty?