PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
Add support to use short forms of type keywords
This adds support to use short forms of type keywords in comments for function parameters and returns and variable types. It fixes #1864 and fixes #1434.
It adds useShortTypes
property, which is by default false
, to Squiz.Commenting.FunctionComment
and Squiz.Commenting.VariableComment
to allow users to use short type checks. If it is enabled, it will force short types in comments and suggest them when long ones are used.
P.S. I would appreciate if you add hacktoberfest-accepted
label to this PR, so it will count for this year's Hacktoberfest.
Any chance to get this merged? Short return types are the way to go, especially because it does not comply to the rules of PSR-12 currently. "Short form of type keywords MUST be used i.e. bool instead of boolean, int instead of integer etc.".
Until such time as this can be merged, I've added a workaround here: https://packagist.org/packages/zebra-north/phpcs-short-types
It's not a proper fix, it would be great if this PR could be merged.
I would love for this to be merged, we are using PHPStorm and it automatically (and correctly) uses short types which we have to manually update to pass our code sniffers