Skip to content

Commit a50da77

Browse files
committed
Dumper: prints comma after last argument
1 parent c1d720e commit a50da77

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/PhpGenerator/Dumper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ private function dumpArguments(array &$var, int $column, bool $named): string
247247
$k = !$named || is_int($k) ? '' : $k . ': ';
248248
$outInline .= $outInline === '' ? '' : ', ';
249249
$outInline .= $k . $this->dumpVar($v, [$var], 0, $column + strlen($outInline));
250-
$outWrapped .= ($outWrapped === '' ? '' : ',') . "\n"
251-
. $this->indentation . $k . $this->dumpVar($v, [$var], 1);
250+
$outWrapped .= "\n" . $this->indentation . $k . $this->dumpVar($v, [$var], 1) . ',';
252251
}
253252

254253
return count($var) > 1 && (str_contains($outInline, "\n") || $column + strlen($outInline) > $this->wrapLength)

tests/PhpGenerator/Dumper.format().phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ same(
5454
33,
5555
34,
5656
35,
57-
36
57+
36,
5858
)',
5959
$dumper->format('func(?*)', range(10, 36)),
6060
);

tests/PhpGenerator/Dumper.format().wrap.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ Assert::same('func(1, 2, 3)', $dumper->format('func(...?)', [1, 2, 3]));
3939
same('loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong(
4040
1,
4141
2,
42-
3
42+
3,
4343
)', $dumper->format('loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong(...?)', [1, 2, 3]));
4444

4545

4646
same('looooooooooooooooooooooooooooooooooooooooo(1, 2, 3) + ooooooooooooooooooooooooooooooooooooooooooooooong(
4747
1,
4848
2,
49-
3
49+
3,
5050
)', $dumper->format('looooooooooooooooooooooooooooooooooooooooo(...?) + ooooooooooooooooooooooooooooooooooooooooooooooong(...?)', [1, 2, 3], [1, 2, 3]));

0 commit comments

Comments
 (0)