Skip to content

Multiple shorthand echoes in a row break when formatted #2022

Open
@alexb148

Description

@alexb148

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 ?>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions