Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Fix php closing braces indent #161

Merged
merged 2 commits into from
May 8, 2017

Conversation

JFFI
Copy link

@JFFI JFFI commented May 8, 2017

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

There is more than one syntax for inline php as shown in the PHP page

The auto-indent currently works for this syntax of inline php:

<?php if ($cond) : ?>
    some-html-here
<?php endif; ?>

but when trying this other syntax the indentation breaks:

<?php if ($cond) { ?>
    some-html-here
    <?php } ?>

So I just added <?php } to the decreaseIndentPattern to make it properly align.

Alternate Designs

I chose this approach because the indentation rules for the alternate syntax were already managed in this variable and it was simply a matter of placing it in the regex.

Benefits

Another syntax of inline php will indent correctly.

Possible Drawbacks

All lines starting with <?php } will decrease indent.

Applicable Issues

I couldn't find any Issue regarding this.

@50Wliu 50Wliu merged commit 9a5e80c into atom:master May 8, 2017
@50Wliu
Copy link
Contributor

50Wliu commented May 8, 2017

Thanks!

@JFFI JFFI deleted the fix-php-closing-braces-indent branch May 9, 2017 16:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants