PHPStorm PHPDoc - int to integer

Answered

Hello

Is there a way to configure the auto-generated phpdoc to use `integer` rather than `int` - our coding standards require `integer`

 

Thanks

2 comments
Comment actions Permalink

Hi there,

  1. The proposed PSR for PHPDoc lists int as allowed keyword and not integer -- https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md#keyword
  2. PSR-12 also suggests to use short int form --  https://www.php-fig.org/psr/psr-12/ (Section 2.5) and PhpStorm highlights integer & boolean and offers converting them to their short form.
  3. Actual native PHP typehints also use short int (and bool).

In any case: this WI-30774 ticket asks for such int -> integer normalizing ... but as per comment there it should actually do other way around (so it's in line with the above points).

Right now there is no such option and it's pretty unlikely that it will appear (in the way you are after).

 

P.S. Actually it was requested in the past and was declined : https://youtrack.jetbrains.com/issue/WI-32615 --> https://youtrack.jetbrains.com/issue/WI-18581 (to use the same what  native PHP types use)

2
Comment actions Permalink

Thanks Andriy, appreciate the detailed reply

0

Please sign in to leave a comment.