Removed modules/contrib/media module to allow update to the core media module
[yaffs-website] / vendor / nikic / php-parser / test / code / formatPreservation / basic.test
1 abc1
2 -----
3 <?php
4 echo
5     1
6         +
7             2
8                 +
9                     3;
10 -----
11 $stmts[0]->exprs[0]->left->right->value = 42;
12 -----
13 <?php
14 echo
15     1
16         +
17             42
18                 +
19                     3;
20 -----
21 <?php
22 function foo($a)
23     { return $a; }
24 -----
25 $stmts[0]->name = new Node\Identifier('bar');
26 -----
27 <?php
28 function bar($a)
29     { return $a; }
30 -----
31 <?php
32 function
33 foo() {
34     call(
35         $bar
36     );
37 }
38 -----
39 // This triggers a fallback
40 $stmts[0]->byRef = true;
41 -----
42 <?php
43 function &foo()
44 {
45     call(
46         $bar
47     );
48 }
49 -----
50 <?php
51 function
52 foo() {
53 echo "Start
54 End";
55 }
56 -----
57 // This triggers a fallback
58 $stmts[0]->byRef = true;
59 -----
60 <?php
61 function &foo()
62 {
63     echo "Start
64 End";
65 }
66 -----
67 <?php
68 function test() {
69     call1(
70         $bar
71     );
72 }
73 call2(
74     $foo
75 );
76 -----
77 $tmp = $stmts[0]->stmts[0];
78 $stmts[0]->stmts[0] = $stmts[1];
79 $stmts[1] = $tmp;
80 -----
81 <?php
82 function test() {
83     call2(
84         $foo
85     );
86 }
87 call1(
88     $bar
89 );
90 -----
91 <?php
92 x;
93 function test() {
94     call1(
95         $bar
96     );
97 }
98 call2(
99     $foo
100 );
101 -----
102 $tmp = $stmts[1]->stmts[0];
103 $stmts[1]->stmts[0] = $stmts[2];
104 $stmts[2] = $tmp;
105 // Same test, but also removing first statement, triggering fallback
106 array_splice($stmts, 0, 1, []);
107 -----
108 <?php
109
110 function test() {
111     call2(
112         $foo
113     );
114 }
115 call1(
116     $bar
117 );
118 -----
119 <?php
120     echo 1;
121 -----
122 $stmts[0] = new Stmt\Expression(
123     new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b')));
124 -----
125 <?php
126     $a = $b;
127 -----
128 <?php
129 echo$a;
130 -----
131 $stmts[0]->exprs[0] = new Expr\ConstFetch(new Node\Name('C'));
132 -----
133 <?php
134 echo C;
135 -----
136 <?php
137 function foo() {
138     foo();
139     /*
140      * bar
141      */
142     baz();
143 }
144
145 {
146     $x;
147 }
148 -----
149 $tmp = $stmts[0];
150 $stmts[0] = $stmts[1];
151 $stmts[1] = $tmp;
152 /* TODO This used to do two replacement operations, but with the node list diffing this is a
153  * remove, keep, add (which probably makes more sense). As such, this currently triggers a
154  * fallback. */
155 -----
156 <?php
157
158 $x;
159 function foo() {
160     foo();
161     /*
162      * bar
163      */
164     baz();
165 }
166 -----
167 <?php
168 echo "${foo}bar";
169 echo "${foo['baz']}bar";
170 -----
171 $stmts[0]->exprs[0]->parts[0] = new Expr\Variable('bar');
172 $stmts[1]->exprs[0]->parts[0] = new Expr\Variable('bar');
173 -----
174 <?php
175 echo "{$bar}bar";
176 echo "{$bar}bar";
177 -----
178 <?php
179 [$a
180 ,$b
181 ,
182 ,] = $b;
183 -----
184 /* Nothing */
185 -----
186 <?php
187 [$a
188 ,$b
189 ,
190 ,] = $b;