php-generics-standard icon indicating copy to clipboard operation
php-generics-standard copied to clipboard

Is a standard needed?

Open DaveLiddament opened this issue 4 years ago • 1 comments

Reasons for formalising a standard

  1. 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.

  1. 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

  1. Some libraries already support generics, so clearly a formal standard is not needed.
  2. 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
  3. A lot of work!

DaveLiddament avatar Jan 08 '21 19:01 DaveLiddament

Another reason against is that PhpStorm does support use of PHPStan and Psalm.

This might be good enough for the majority of developers.

DaveLiddament avatar Jan 29 '21 11:01 DaveLiddament