php-generics-standard
php-generics-standard copied to clipboard
Is a standard needed?
Reasons for formalising a standard
- It might increase uptake. The lack of a standard is the reason cited in PHPStorm's 2020.3 release announcement for not fully supporting
@template
:
We believe that support for generics is an advanced feature that lacks a proper specification and has many edge cases. Yet, we have decided to implement basic support for the @template construct based on the Psalm syntax, to see how it goes.
- Library and framework maintainers might be happier to have the generics annotations in their code if there was a standard.
Reasons for aborting this project
- Some libraries already support generics, so clearly a formal standard is not needed.
- Those who want the power of generics have it already. If they make use of a library that doesn't have the generics annotations then stubs and plugins exist, or can be written, to provide support with static analysers
- A lot of work!
Another reason against is that PhpStorm does support use of PHPStan and Psalm.
This might be good enough for the majority of developers.