Every Laravel dev has written PHP generics. You just wrote them inside a comment and pretended it didn't count.
/** @return Collection<CartItemDTO> */
Enter fullscreen mode
Exit fullscreen mode
That line is a generic type. PHPStan reads it, your IDE reads it, but PHP itself shrugs and ignores it. A new RFC, Bound-Erased Generic Types, wants to turn those comments into real syntax. Let's start with what a generic even is, then look at why PHP has fought this for a decade.






