Skip to content

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

@nexces

Description

@nexces

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions