A PHP internals mailing list discussion about a proposed RFC for bound-erased generic types in PHP. The RFC proposes adding generic type parameters to classes, interfaces, traits, functions, methods, closures, and arrow functions, with bounds, defaults, and variance markers. Type parameters erase to their bound at runtime, while the pre-erasure form is preserved for Reflection and static analyzers. The discussion covers key design decisions including: type parameter ordering restrictions, intersection type constraints, arity validation (opt-in via turbofish syntax), diamond inheritance checks, the turbofish `::< >` syntax for explicit type arguments, and `+`/`-` variance markers. Bob Weinand provides detailed feedback questioning several restrictions, and RFC author Seifeddine Gmati responds point-by-point defending design choices while acknowledging some areas for improvement before a vote.

5h 10m read timeFrom externals.io
Post cover image
167 Impressions