Skip to content

Commit 5e60691

Browse files
committed
move to test/code/formatPreservation
1 parent 404c19a commit 5e60691

File tree

2 files changed

+13
-32
lines changed

2 files changed

+13
-32
lines changed

test/PhpParser/PrettyPrinterTest.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use PhpParser\Node\Scalar\Int_;
1111
use PhpParser\Node\Scalar\String_;
1212
use PhpParser\Node\Stmt;
13-
use PhpParser\Node\VariadicPlaceholder;
1413
use PhpParser\PrettyPrinter\Standard;
1514

1615
class PrettyPrinterTest extends CodeTestAbstract {
@@ -306,35 +305,4 @@ public function testInvalidIndent(): void {
306305
$this->expectExceptionMessage('Option "indent" must either be all spaces or a single tab');
307306
new PrettyPrinter\Standard(['indent' => "\t "]);
308307
}
309-
310-
public function testTrailingCommaArgToFirstClassCallable(): void {
311-
$parser = (new ParserFactory())->createForNewestSupportedVersion();
312-
$traverser = new NodeTraverser(new NodeVisitor\CloningVisitor());
313-
314-
$oldStmts = $parser->parse(<<<'CODE'
315-
<?php
316-
strlen(
317-
"test",
318-
);
319-
CODE
320-
);
321-
$oldTokens = $parser->getTokens();
322-
$newStmts = $traverser->traverse($oldStmts);
323-
324-
$funcCall = $newStmts[0]->expr;
325-
$funcCall->args = [new VariadicPlaceholder()];
326-
327-
$prettyPrinter = new PrettyPrinter\Standard();
328-
$expected = <<<'CODE'
329-
<?php
330-
strlen(
331-
...
332-
);
333-
CODE;
334-
335-
$this->assertEquals(
336-
$expected,
337-
$prettyPrinter->printFormatPreserving($newStmts, $oldStmts, $oldTokens)
338-
);
339-
}
340308
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Replace args with VariadicPlaceholder should remove trailing comma
2+
-----
3+
<?php
4+
strlen(
5+
'test',
6+
);
7+
-----
8+
$stmts[0]->expr->args = [new Node\VariadicPlaceholder()];
9+
-----
10+
<?php
11+
strlen(
12+
...
13+
);

0 commit comments

Comments
 (0)