plugin-php
plugin-php copied to clipboard
chained method wrapping inconsistent when comments inside arguments
When a comment is added inside the argument of secondMethod below, it changes the way that the chained methods are wrapped in a way that doesn't seem intuitive for it to affect.
@prettier/plugin-php v0.19.3 Playground link
Input:
<?php
$builder->firstMethod()->secondMethod([
new ClassName('c-' . $some_long_variable, [
EXTEND::THIS, LINE::SO, IT::HASNEWLINES
]),
new ClassName('c-' . $some_long_variable, [
EXTEND::THIS, LINE::SO, IT::HASNEWLINES
]),
]);
Output:
<?php
$builder
->firstMethod()
->secondMethod([
new ClassName("c-" . $some_long_variable, [
EXTEND::THIS,
LINE::SO,
IT::HASNEWLINES,
]),
new ClassName("c-" . $some_long_variable, [
EXTEND::THIS,
LINE::SO,
IT::HASNEWLINES,
]),
]);
@prettier/plugin-php v0.19.3 Playground link
Input:
<?php
$builder->firstMethod()->secondMethod([
new ClassName('c-' . $some_long_variable, [
EXTEND::THIS, LINE::SO, IT::HASNEWLINES
]),
// comment
new ClassName('c-' . $some_long_variable, [
EXTEND::THIS, LINE::SO, IT::HASNEWLINES
]),
]);
Output:
<?php
$builder->firstMethod()->secondMethod([
new ClassName("c-" . $some_long_variable, [
EXTEND::THIS,
LINE::SO,
IT::HASNEWLINES,
]),
// comment
new ClassName("c-" . $some_long_variable, [
EXTEND::THIS,
LINE::SO,
IT::HASNEWLINES,
]),
]);