Skip to content

Commit a3052c8

Browse files
committed
add weird newlines
1 parent 7c5ae82 commit a3052c8

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

lib/PhpParser/PrettyPrinterAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ protected function p(
767767

768768
$tokenCode = $this->origTokens->getTokenCode($pos, $endPos + 1, $indentAdjustment);
769769
if ($node instanceof Expr\CallLike && $node->isFirstClassCallable()) {
770-
$tokenCode = trim($tokenCode, ',');
770+
$tokenCode = str_replace(',', '', $tokenCode);
771771
}
772772

773773
$result .= $tokenCode;

test/code/formatPreservation/args_to_variadic_remove_trailing_comma.test

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ strlen(
66
'test',
77
);
88

9+
strlen(
10+
'test'
11+
12+
,
13+
);
14+
915
strlen('another',);
1016

1117
strlen(1, 2, 3, ) > strlen(1 , 2 , 3 ,);
@@ -18,21 +24,28 @@ strlen(
1824
-----
1925
$stmts[0]->expr->args = [new Node\VariadicPlaceholder()];
2026
$stmts[1]->expr->args = [new Node\VariadicPlaceholder()];
21-
$stmts[2]->expr->right->args = [new Node\VariadicPlaceholder()];
22-
$stmts[3]->expr->args = [new Node\VariadicPlaceholder()];
27+
$stmts[2]->expr->args = [new Node\VariadicPlaceholder()];
28+
$stmts[3]->expr->right->args = [new Node\VariadicPlaceholder()];
29+
$stmts[4]->expr->args = [new Node\VariadicPlaceholder()];
2330
-----
2431
<?php
2532

2633
strlen(
2734
...
2835
);
2936

37+
strlen(
38+
...
39+
40+
41+
);
42+
3043
strlen(...);
3144

3245
strlen(1, 2, 3, ) > strlen(...);
3346

3447
strlen(
35-
'multiple new lines'
48+
...
49+
3650

37-
,
3851
);

0 commit comments

Comments
 (0)