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

Multiple shorthand echoes in a row break when formatted

Open alexb148 opened this issue 3 years ago • 0 comments

Prettier 2.4.0

PHP Plugin 0.18.4

Input:

<?= $var1 ?><?= $var2 ?>

Output:

<?=
$var1
$var2
?>

Expected behavior:

The above output does not work, it is fundamentally broken code.

There should be no change:

<?= $var1 ?><?= $var2 ?>

...or the variables should be concatenated:

<?= $var1 . $var2 ?>

Note that if there is a space in the middle, this works fine and is not changed:

<?= $var1 ?> <?= $var2 ?>

alexb148 avatar Jun 29 '22 10:06 alexb148