Open louisl opened 7 years ago
With Allman structures you wouldn't expect anything other than a brace on a line so maybe it could check that?
Actually you cant do that in case of this scenario where someones standard might require end comments:
if ($a === $b)
{
return $b;
} // Check if a = c.
elseif ($a === $c) // Does a = c?
{
return $c;
} // Check if a = d.
elseif ($a === $d) // Does a = d?
{
return $d;
} // end if
I think it might require a custom sniff which disallows comments on brace lines for Allman structures.
I've switched this to a warning in my ruleset for now while I think about it.
<rule ref="Squiz.Commenting.PostStatementComment">
<type>warning</type>
<exclude phpcbf-only="true" name="Squiz.Commenting.PostStatementComment.Found"/>
</rule>
I'm getting a loop here because my AllmanControlSignatureSniff is picking up the brace being on the wrong line after the comment is 'fixed' then trying to fix it.
With Allman structures you wouldn't expect anything other than a brace on a line so maybe it could check that?
phpcbf -p -s ./test.php --standard=Squiz --sniffs=Squiz.Commenting.PostStatementComment
test.php
Fixed
Expected