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

PEAR/ScopeClosingBrace: prevent fixer conflict with itself #423

Merged
merged 1 commit into from
Apr 3, 2024

Commits on Apr 3, 2024

  1. PEAR/ScopeClosingBrace: prevent fixer conflict with itself

    The `PEAR.WhiteSpace.ScopeClosingBrace` sniff could get into a conflict with itself when the scope closer was preceded by a PHP open tag and before that non-empty (i.e. non-indent) inline HTML.
    
    In that case, the sniff would not recognize that the close brace was not on a line by itself, as the search for the last content before would disregard the non-empty HTML and would continue searching, which meant that the "last relevant content before" token would point to a token on a previous line.
    
    This, in turn, then led to the sniff continuing on to the next error "Closing brace indented incorrectly", where the indent would now be incorrectly determined as `-1`, which in the fixer would lead to the original content and the replacement content being exactly the same, which created a fixer conflict.
    
    Fixed now by improving the "last content before" determination.
    
    Includes unit test.
    
    Related to 152
    jrfnl committed Apr 3, 2024
    Configuration menu
    Copy the full SHA
    436d243 View commit details
    Browse the repository at this point in the history