You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Running PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE can remove comments which are on the same line as the case statement
Code sample
$test = 2;
switch ( $test ) {
case2: // comment followed by empty lineecho "test 2";
}
gsherwood
changed the title
phpcbf fix for PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE can remove comments on the same line as the case statement
PSR2.ControlStructures.SwitchDeclaration can remove comments on the same line as the case statement while fixing
May 27, 2021
Describe the bug
Running
PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE
can remove comments which are on the same line as thecase
statementCode sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcbf test.php ...
Expected behavior
The remove of the empty line is correct, but the comment should stay from my point of view.
Versions (please complete the following information):
Additional context
The fixer starts directly after the colon/scope opener to remove everything there, not at the end of the line
Seems an issue since the fix for #683, which ignores the comments, but does not adjust the fixer part.
The text was updated successfully, but these errors were encountered: