Open rodrigoprimo opened 4 months ago
I wonder if single-line trailing comments using
/* ... */
should be flagged as well or not. I think they should, as this is yet another valid type of trailing comment, but I'm not sure.
I'm fine with flagging all three variants - with the explicit caveat that the /* */
style comment should only be flagged when single-line.
We might also want to have a think about whether all three should be flagged with the existing error code or that each type of trailing comment should have its own error code. In principle, I think the same error code should be used as they are all trailing comments, but opinions may differ on this.
Describe the bug
Squiz.Commenting.PostStatementComment
flags only single-line trailing comments that start with//
. But, as @jrfnl mentioned in https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/560#issuecomment-2237930952,#
is also a valid single-line trailing comment in PHP and should be flagged by the sniff as well.I wonder if single-line trailing comments using
/* ... */
should be flagged as well or not. I think they should, as this is yet another valid type of trailing comment, but I'm not sure.Code sample
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above.phpcs -s --standard=Squiz --sniffs=Squiz.Commenting.PostStatementComment test.php
Expected behavior
Besides displaying an error message for line 1, which already happens, I expect PHPCS to display an error for line 2 and potentially line 3 as well.
Versions (please complete the following information)
Please confirm
master
branch of PHP_CodeSniffer.