Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/PhpParser/PrettyPrinterAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,13 @@ protected function p(
$pos = $subEndPos + 1;
}

$result .= $this->origTokens->getTokenCode($pos, $endPos + 1, $indentAdjustment);
$tokenCode = $this->origTokens->getTokenCode($pos, $endPos + 1, $indentAdjustment);
if ($node instanceof Expr\CallLike && $node->isFirstClassCallable()) {
$tokenCode = str_replace(',', '', $tokenCode);
Comment thread
TomasVotruba marked this conversation as resolved.
Comment thread
TomasVotruba marked this conversation as resolved.
}

$result .= $tokenCode;

return $result;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Replace args with VariadicPlaceholder should remove trailing comma
-----
<?php

strlen(
'test',
);

strlen('another',);

strlen(1, 2, 3, ) > strlen(1 , 2 , 3 ,);

strlen(
'multiple new lines'

,
);
-----
$stmts[0]->expr->args = [new Node\VariadicPlaceholder()];
$stmts[1]->expr->args = [new Node\VariadicPlaceholder()];
$stmts[2]->expr->right->args = [new Node\VariadicPlaceholder()];
$stmts[3]->expr->args = [new Node\VariadicPlaceholder()];
-----
<?php

strlen(
...
);

strlen(...);

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

strlen(
...


);