1
0
mirror of https://github.com/nikic/PHP-Parser.git synced 2025-05-09 23:05:23 +02:00
Nikita Popov cad49f8ed3 Fix formatting preservation for alternative elseif/else syntax
Test taken from PR .

(cherry picked from commit 9b46dffb12c6c83d33b993ae81b9a2895293dee8)
2023-03-05 20:44:50 +01:00

53 lines
669 B
Plaintext

Comment changes
-----
<?php
// Test
foo();
-----
$stmts[0]->setAttribute('comments', []);
-----
<?php
foo();
-----
<?php
$foo;
/* bar */
$baz;
-----
$comments = $stmts[1]->getComments();
$comments[] = new Comment("// foo");
$stmts[1]->setAttribute('comments', $comments);
-----
<?php
$foo;
/* bar */
// foo
$baz;
-----
<?php
class Test {
/**
* @expectedException \FooException
*/
public function test() {
// some code
}
}
-----
$method = $stmts[0]->stmts[0];
$method->setAttribute('comments', [new Comment\Doc("/**\n *\n */")]);
-----
<?php
class Test {
/**
*
*/
public function test() {
// some code
}
}