Closed fredden closed 1 year ago
PSR-19 makes no mention of variables passed by reference. Based on this, I'll update this pull request to instead ignore this character and not auto-fix.
MissingParamTag
- I have adjusted the sniff to not throw this when the variable is prefixed incorrectly in the @param
tag. Should this still be thrown when only the case mismatches? For example,
1) PHP_CodeSniffer\Standards\Squiz\Tests\Commenting\FunctionCommentUnitTest::testSniff
[LINE 1050] Expected 0 error(s) in FunctionCommentUnitTest.inc but found 1 error(s). The error(s) found were:
-> Doc comment for parameter "$CASE" missing (Squiz.Commenting.FunctionComment.MissingParamTag)
[LINE 1063] Expected 0 error(s) in FunctionCommentUnitTest.inc but found 1 error(s). The error(s) found were:
-> Doc comment for parameter &$case does not match case of actual variable name &$CASE (Squiz.Commenting.FunctionComment.ParamNameNoCaseMatch)
MissingParamTag
- I have adjusted the sniff to not throw this when the variable is prefixed incorrectly in the@param
tag. Should this still be thrown when only the case mismatches? For example,
Parameters in PHP are case-sensitive, so yes, case mismatches should IMO definitely be flagged.
Thanks for your time & patience on this one @jrfnl. I appreciate the feedback etc.
@fredden Would you mind rebasing this PR (and possibly squashing the commits) to get it past the merge conflict ?
@fredden Would you mind rebasing this PR (and possibly squashing the commits) to get it past the merge conflict ?
Yes, no problem. I'll look at this today.
FYI: this fix is included in today's PHP_CodeSniffer 3.8.0 release.
As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo).
This started as an auto-fix to remove ampersands from
@param
tags in docblocks withinSquiz.Commenting.FunctionComment
. This has evolved into "handle@param
tags for variables passed by reference." We are also increasing test coverage of related-but-not-changed behaviour.