61f21e2f56333a74aea25704bcfe2f9245c775be
[yaffs-website] / vendor / nikic / php-parser / test / code / formatPreservation / comments.test
1 Comment changes
2 -----
3 <?php
4 // Test
5 foo();
6 -----
7 $stmts[0]->setAttribute('comments', []);
8 -----
9 <?php
10 foo();
11 -----
12 <?php
13 $foo;
14
15
16 /* bar */
17 $baz;
18 -----
19 $comments = $stmts[1]->getComments();
20 $comments[] = new Comment("// foo");
21 $stmts[1]->setAttribute('comments', $comments);
22 -----
23 <?php
24 $foo;
25
26
27 /* bar */
28 // foo
29 $baz;
30 -----
31 <?php
32 class Test {
33     /**
34      * @expectedException \FooException
35      */
36     public function test() {
37         // some code
38     }
39 }
40 -----
41 $method = $stmts[0]->stmts[0];
42 $method->setAttribute('comments', [new Comment\Doc("/**\n *\n */")]);
43 -----
44 <?php
45 class Test {
46     /**
47      *
48      */
49     public function test() {
50         // some code
51     }
52 }