plugin-php icon indicating copy to clipboard operation
plugin-php copied to clipboard

The formatting of sequential echo short tags is broken

Open yuheiy opened this issue 5 years ago • 5 comments

@prettier/plugin-php v0.14.3 Playground link

Input:

<?php
$a = 'a';
$b = 'b';
?>
<?= $a ?><?= $b ?>

Output:

<?php
$a = 'a';
$b = 'b';
?>
<?=
$a
$b
 ?>

yuheiy avatar Aug 26 '20 09:08 yuheiy

Oh, this seems to happen without using a short tag.

@prettier/plugin-php v0.14.3 Playground link

Input:

<?php
$a = 'a';
$b = 'b';
?>
<?php echo $a; ?><?php echo $b; ?>

Output:

<?php
$a = 'a';
$b = 'b';
?>
<?php
echo $a;
echo $b;
 ?>

yuheiy avatar Aug 26 '20 09:08 yuheiy

yes, buggy :disappointed:

/cc @czosel Do you have ideas how we can fix inline printing, it is main painful right now

alexander-akait avatar Aug 26 '20 09:08 alexander-akait

@evilebottnawi I'm not sure, I think the closest we got to a solution was here: https://github.com/glayzzle/php-parser/issues/170

czosel avatar Aug 26 '20 11:08 czosel

Maybe I can find some time in the near future and try to solve this old and annoying problem.

alexander-akait avatar Aug 26 '20 11:08 alexander-akait

Would be amazing if we could solve it - then we could release a true v1.0.0 :wink: Let me know when you start your attempt, I'll do my best to help :slightly_smiling_face:

czosel avatar Aug 26 '20 11:08 czosel