prettier / plugin-php

Prettier PHP Plugin
https://loilo.github.io/prettier-php-playground/
MIT License
1.73k stars 124 forks source link

[Bug] 2 snippets which make the file no more valid PHP. #1321

Open Yivan opened 4 years ago

Yivan commented 4 years ago

Hello,

On the last prettier version at this time and last php plugin version, those 2 code snippets make the php file invalid after.

SNIPPET 1

Before:

<?=$this->input('before') ?><?=$this->numeric('value');?><?=$this->input('after') ?>

After:

<?=
      $this->input('before')
      $this->numeric('value')
      $this->input('after')
?>

SNIPPET 2

Before:

<?php /* Some text */ 
if ($this->context ==='cars' || ($this->context !=='cars' && $this->editmode)) : ?>

After:

 /* Some text */<?php
/* Some text */
?>if (
    $this->context === 'cars' ||
    ($this->context !== 'cars' && $this->editmode)
): ?>

Hope it help to achieve a stable version. Big thumbs up for this wonderfull plugin !

czosel commented 4 years ago

Thanks for the bug report @Yivan :slightly_smiling_face: