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

Squiz.Sniffs.Whitespace.ScopeClosingBraceSniff marking indented endif in mixed inline HTML blocks #709

Closed
nexces opened this issue Sep 17, 2015 · 1 comment

Comments

@nexces
Copy link

nexces commented Sep 17, 2015

Sample file:

<!doctype html>
<html lang="en">
<body>
    <div>
    <?php if (true == false) : ?>
        <h1>o hai!</h1>
    <?php endif; ?>
    </div>
</body>
</html>

When launching code sniffer with PSR-2 standard it gives one error:

----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 7 | ERROR | [x] Closing brace must be on a line by itself
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Using alternative syntax is a quite common in view files and IMHO Squiz.Sniffs.Whitespace.ScopeClosingBraceSniff should interpret indented "" as correct if it is aligned with opening IF statement.

@gsherwood gsherwood changed the title Squiz.Sniffs.Whitespace.ScopeClosingBraceSniff marking indented <?php endif; ?> Squiz.Sniffs.Whitespace.ScopeClosingBraceSniff marking indented endif in mixed inline HTML blocks Sep 20, 2015
gsherwood added a commit that referenced this issue Sep 20, 2015
…ng indented endif in mixed inline HTML blocks
@gsherwood
Copy link
Member

Thanks for reporting. Already supported this in theory, but previous test code wasn't indented as so missed this case.

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

2 participants