Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Generics are well supported in PHP static analysers PHPStan and Psalm, and somewhat supported in PhpStorm. If you can make sure your code is never run in production without having passed static analysis check first you may find that is enough and you don't need generics support in the actual language. Commented Jan 28, 2022 at 13:26
  • There's even github.com/Roave/you-are-using-it-wrong in case you want to make sure that downstream consumers of your library respect your generic types. Commented Jan 28, 2022 at 13:27