Remove spacing on line without output
This is a real pet peeve of mine that I haven't been able to figure out yet. If I have a php tag that has no output then I would like all formatting on that line removed (spaces, tabs, new line). In truth I am not sure if this is something that Jetbrains can do or if I need to look at PHP. Example:
Source:
<?php foreach($foo as $bar): ?>
<div>
Some Text
</div>
<?php endforeach; ?>
Output (. notates extra space):
....<div>
Some Text
</div>
Desired Output:
<div>
Some Text
</div>
Please sign in to leave a comment.
Hi there,
AFAIK that's how PHP itself (and even other template engines like Twig/etc .. simply because it then gets compiled into PHP code anyway) works.
If you want no extra spaces .. then make sure that you have no leading spaces before PHP code. This means: no whitespace characters (space/tabs) on this line before <?php tag:
In other words -- you cannot use indents for visually structuring your code / logic (like you do with actual PHP code)