Closed Shou-nen closed 4 years ago
Any news on fixing this?
@ovidiu-balau So realistically you would use an inline ternary operator in that particular example. The reason the formatting is messed up is because the
tags aren't being open and closed properly.
This would be a more realistic example of doing that in the real world.
<p class="<?php echo (1) ? 'c1' : 'c2'; ?>">
text
</p>
After
<p class="<?php echo (1) ? 'c1' : 'c2'; ?>">
text
</p>
Which is pretty much as expected. So a more realistic look at the else endif situation would be doing something like this.
<p>
<?php if (1) : ?>
<span class="c1">
hi
</span>
<?php else : ?>
<span class="c2">
hi
</span>
<?php endif ?>
text
</p>
After
<p>
<?php if (1) : ?>
<span class="c1">
hi
</span>
<?php else : ?>
<span class="c2">
hi
</span>
<?php endif ?>
text
</p>
Which also comes out as expected.
Feel free to reopen this if you think I'm missing something here, I would be happy to take another look at a different example.
Before:
After:
It doesn't look good.