Closed JPry closed 6 months ago
When I run phpcbf
with this file and ruleset, the equal signs all line up. This is the same behaviour as with the following code snippet:
<?php
$zero = 0;
$one |= 1;
$two &= 2;
$three += 3;
$four -= 4;
See also the documentation for this sniff, which shows that the equals signs should line up: https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/3.9.0/src/Standards/Generic/Docs/Formatting/MultipleStatementAlignmentStandard.xml#L43-L48
@JPry Thanks for opening this issue, but I agree with @fredden that this is by design and that the sniff is working exactly as intended.
@fredden @jrfnl Thanks for the responses. I hadn't personally encountered this situation before so I wasn't sure that it was correct. Good to know it's working as intended.
Describe the bug
I have a series of 4 assignment statements. The first 3 statements are assigned using the null coalesce assignment (
??=
), while the 4th statement is assigned using normal assignment (=
). When checking the file with wpcs, it generates a warning message. I believe this warning is not correct.The "maybe" part of this issue is that I might have the wrong idea of what should be correct here.
Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php ...
Expected behavior
I expected that this series of statements should not trigger a warning.
Versions (please complete the following information)
3.7.2
Please confirm:
master
branch of PHP_CodeSniffer.