phpDocumentor / fig-standards

Standards either proposed or approved by the Framework Interop Group
http://www.php-fig.org/
Other
361 stars 85 forks source link

Add number pseudo-type #142

Closed zonuexe closed 5 years ago

zonuexe commented 7 years ago

number pseudo-type can be found in the PHP manual. This keyword is defined in PHP: Pseudo-types and variables used in this documentation - Manual.

PhpStorm seems to already implement this keyword as a pseudo-type.

I propose to add number into Appendix A. Types.

ashnazg commented 5 years ago

With this being a recognized pseudo-type by the PHP manual, I'm inclined to agree.

neuro159 commented 5 years ago

"PhpStorm seems to already implement this keyword as a pseudo-type." First of all - I think we shall move in direction to having same types in php code and doc.

Anyway - as most of doc-related stuff we support - in the beginning I scanned a LOT of projects and used the stats. Number was there, especially in older code. So I just made it behave intuitively (like base class for int and float).

We usually only generate actual inferred type int or float if possible, and thus see a decline on "number" usage along years.

Still gives us some pain - PPL make classes called Number and more https://youtrack.jetbrains.com/issue/WI-40675 was same with String and Object custom classes but nowadays very rare.

Would be great to have such type names reserved. May be "deprecated" == never generated by tool and treated in type computations as int|float.

ashnazg commented 5 years ago

@neuro159 so you'd prefer that we _not* add number, so that eventually you can take that behavior out of PhpStorm? Or perhaps mention number in the meta-doc as "known usage in the wild, but should be considered deprecated"?

ashnazg commented 5 years ago

@zonuexe , if you wish to pursue this further, please bring this up as a new thread on the FIG mailing list for discussion -- https://groups.google.com/forum/#!forum/php-fig