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

Universal/DisallowLonelyIf: bow out early for a specific situation (PHP close tag) #169

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Dec 1, 2022

If an inner "if/else" chain using alternative syntax has a PHP close tag after the endif instead of a semi-colon, we know there will need to be a PHP open tag before the closer for the "outer" else can be reached, so this means there will always be additional content within the outer else which doesn't belong with the inner if, i.e. it's not a lonely if.

This commit implements bowing out early for that situation.

Includes unit test.

Includes minor tweaks to the inline documentation to make it clearer that the do-while code is part of the "Find the end of an if - else chain." block.

…HP close tag)

If an inner "if/else" chain using alternative syntax has a PHP close tag after the `endif` instead of a semi-colon, we **know** there will need to be a PHP open tag before the closer for the "outer" `else` can be reached, so this means there will always be additional content within the outer `else` which doesn't belong with the inner `if`, i.e. it's not a lonely `if`.

This commit implements bowing out early for that situation.

Includes unit test.

Includes minor tweaks to the inline documentation to make it clearer that the `do-while` code is part of the "Find the end of an if - else chain." block.
@jrfnl jrfnl added this to the 1.0.0-alpha4 milestone Dec 1, 2022
@jrfnl jrfnl merged commit 3d4bb19 into develop Dec 1, 2022
@jrfnl jrfnl deleted the universal/disallowlonelyif-bow-out-early-for-close-tag branch December 1, 2022 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant