<div></div>
<?php echo 'test'; ?>
<?php echo 'test'; ?>
<div></div>
@evilebottnawi this is fixed right?
@mgrip no
ok so just checked, and this works, but you loose the 2nd php tag
<div></div>
<?php
echo 'test';
echo 'test';
?>
<div></div>
Maybe this is just personal preference but I think the way we currently output is fine?
@mgrip it is other discussion, by default we don't change ast
Just a heads up --
<div></div>
<?php echo 'test'; ?>
<?php echo 'test'; ?>
<div></div>
does not equal
<div></div>
<?php
echo 'test';
echo 'test';
?>
<div></div>
There's a new line character that's now missing. That's important for .phtml that frequently interweaves PHP blocks. Not sure by last comment if the second block is the resulting code; however, it should not. It should keep all php tags and corresponding spacing outside the php blocks.
/cc @mgrip what do you think, after refactor inline, it is easy fix?
Unfortunately the parser treats the 2 cases exactly the same - ideally it would pick up the case with 2 sets of tags as having an extra inline node in between the two echo nodes. _But_ the parent program node does have the source prop - we could theoretically check this to see if there to find the extra tags. So definitely possible, i can try to take a look today or monday.
@mgrip what about looks in source code?
Yup! That's probably how we'll have to do it - but we'll have to look in the parent program node - the tags don't exist in the source prop for either of the echo nodes

Or I guess we could maybe use originalText, similar to https://github.com/prettier/plugin-php/blob/c6eae45624149e52dddf7fb31ecb66e9e74ffb0d/src/printer.js#L100 ?
@mgrip maybe need investigate
Fixed
Most helpful comment
Fixed