Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic/MultipleStatementAlignment: false positive with non-scoped control structures #16

Open
jrfnl opened this issue Nov 8, 2023 · 0 comments

Comments

@jrfnl
Copy link
Member

jrfnl commented Nov 8, 2023

Repost from squizlabs/PHP_CodeSniffer#2578:

Ported over from: squizlabs/PHP_CodeSniffer#2529 (comment)

$phrase = 'phrase';
if ($a === true)
    if ($b === true)
        $phrase = 'another phrase';
else
    $phrase = 'different phrase';

Throws:

 3 | WARNING | [x] Equals sign not aligned with surrounding assignments; expected 9
   |         |     spaces but found 1 space
   |         |     (Generic.Formatting.MultipleStatementAlignment.NotSameWarning)
 8 | WARNING | [x] Equals sign not aligned with surrounding assignments; expected 5
   |         |     spaces but found 1 space
   |         |     (Generic.Formatting.MultipleStatementAlignment.NotSameWarning)

Caused by the control structure not having any braces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant