plugin-php
plugin-php copied to clipboard
Prettier PHP Plugin
**Prettier 1.14.3** **PHP Plugin 0.8.0** ```sh # Options (if any): --single-quote ``` **Input:** ```php try {} catch( // comment Exception // comment $foo // comment ) {} ``` **Output:** ```php...
**Prettier 1.14.3** **PHP Plugin 0.9.0** Same as for `if`, `else if` and `else` **Input:** ```php // Comment try { return tap($callback($this), function () { $this->commit(); }); } // Comment catch...
**Prettier 1.14.3** **PHP Plugin 0.9.0** **Input:** ```php
/cc @czosel Current parser does not improve and does not fix bugs, I propose to go to your own parser, we can use https://github.com/nikic/PHP-Parser/tree/master/grammar as example. I know it is...
Not sure if the following snippet should be as badly malformatted as it is? I'd expect the output to be similar to the input — but it gets pretty mangled....
**@prettier/plugin-php v0.11.2** [Playground link](https://loilo.github.io/prettier-php-playground/#N4IgDgTgpgLjCWUIHkwIPYDsDOIBcok8mMA6vACYwAW+AHAAwA0IMAhgEblW14AsLAK7YoAFU648AMzYAbES2zEA5rKgBFQehhR8M+VBYwIbeLJUBhdAFtrbAAoAJe-hCYsulhxMBjKAGUYAE81VzBsCABaACYQFmgAR0F4aHsTZTs9OQUQYhEIGDS2DLYsgwBfFigKeBh0FDR4LElQNmwYfGNBKErczDBBDrwQAAIAHgB+MGowEYB6OZGfG2soEgAdTCgfanQRmigAfWWSNZgACgBKAG4RiYA+EHKgA) **Input:** _with space before the PHP starting tag_ ```php ``` **Output:** ```php echo the_content(); ?> ``` The extra PHP closing tag break the PHP code itself...
```php $db->Execute([ $foo, $bar, $foobar, $somewhatLongParameter, $somewhatLongParameterX, $somewhatLongParameterXYZ ], $sql, $someOtherArg); ``` VS ```php $db->Execute( [ $foo, $bar, $foobar, $somewhatLongParameter, $somewhatLongParameterX, $somewhatLongParameterXYZ ], $sql, $someOtherArg ); ``` Vote :+1: on...
> **Disclaimer:** I am aware that it's not make-or-break for Prettier to adhere to PSR-12. > > However, now that it is officially accepted as a standard, we should discuss...
> **Disclaimer:** I am aware that it's not make-or-break for Prettier to adhere to PSR-12. > > However, now that it is officially accepted as a standard, we should discuss...
**Prettier 1.16.4** **PHP Plugin 0.10.2** ```sh # Options (if any): --single-quote ``` **Input:** ```php use /* Comment */ some\\namespaces\\/* Comment */{ /* Comment */ClassA/* Comment */, /* Comment */ ClassB/*...