@@ -1,2 +1,1 @@ |
||
1 | 1 | <?php |
2 | -/** Why me? |
@@ -1,2 +1,1 @@ |
||
1 | 1 | <?php |
2 | -/** Why me? |
|
3 | 2 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | - <<<"EOD" |
|
27 | - Merge conflicts in PHP 7.3 indented heredocs |
|
28 | -<<<<<<< HEAD |
|
29 | - can be problematic. |
|
30 | -======= |
|
31 | - should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | - And now they are. |
|
34 | - EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -22,22 +22,4 @@ |
||
22 | 22 | <<<<<<< HEAD |
23 | 23 | $a = 1; |
24 | 24 | ======= |
25 | -$a = 2; |
|
26 | ->>>>>>> master |
|
27 | - |
|
28 | -/* |
|
29 | - * The above tests are based on "normal" tokens. |
|
30 | - * The below test checks that once the tokenizer breaks down because of |
|
31 | - * unexpected merge conflict boundaries - i.e. after the first merge conflict |
|
32 | - * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent |
|
33 | - * merge conflict boundaries will still be detected correctly. |
|
34 | - */ |
|
35 | -?> |
|
36 | - |
|
37 | -<div class="abc"> |
|
38 | -<<<<<<< HEAD |
|
39 | - <p id="test-this">Testing a merge conflict.</p> |
|
40 | -======= |
|
41 | - <p id="test-that">Another text string.</p> |
|
42 | ->>>>>>> ref/heads/feature-branch |
|
43 | -</div> |
|
25 | +$a |
|
44 | 26 | \ No newline at end of file |
@@ -24,8 +24,3 @@ |
||
24 | 24 | |
25 | 25 | // Comment |
26 | 26 | <<<<<<< HEAD |
27 | -// Second comment line. NOTE: The above opener breaks the tokenizer. |
|
28 | -======= |
|
29 | -// New second comment line |
|
30 | ->>>>>>> master |
|
31 | -// Third comment line |
@@ -64,8 +64,4 @@ |
||
64 | 64 | <<<<<<< HEAD |
65 | 65 | can be problematic. |
66 | 66 | EOD; |
67 | -$a = 1; |
|
68 | -======= |
|
69 | -should also be detected. |
|
70 | -EOT; |
|
71 | ->>>>>>> ref/heads/other-branchname |
|
67 | +$a |
|
72 | 68 | \ No newline at end of file |
@@ -57,5 +57,4 @@ |
||
57 | 57 | |
58 | 58 | // Test that stray boundaries, i.e. an opener without closer and such, are detected. |
59 | 59 | <<<<<<< HEAD |
60 | -$a = 1; |
|
61 | -======= |
|
60 | +$a |
|
62 | 61 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | -<<<'EOD' |
|
27 | -can be problematic. |
|
28 | -<<<<<<< HEAD |
|
29 | -were previously not detected. |
|
30 | -======= |
|
31 | -should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | -And now they are. |
|
34 | -EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -1,27 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ($something) echo 'hello'; |
|
3 | +if ($something) { |
|
4 | + echo 'hello'; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | if ($something) { |
6 | 8 | echo 'hello'; |
7 | -} else echo 'hi'; |
|
9 | +} else { |
|
10 | + echo 'hi'; |
|
11 | +} |
|
8 | 12 | |
9 | 13 | if ($something) { |
10 | 14 | echo 'hello'; |
11 | -} else if ($else) echo 'hi'; |
|
15 | +} else if ($else) { |
|
16 | + echo 'hi'; |
|
17 | +} |
|
12 | 18 | |
13 | -foreach ($something as $thing) echo 'hello'; |
|
19 | +foreach ($something as $thing) { |
|
20 | + echo 'hello'; |
|
21 | +} |
|
14 | 22 | |
15 | -for ($i; $i > 0; $i--) echo 'hello'; |
|
23 | +for ($i; $i > 0; $i--) { |
|
24 | + echo 'hello'; |
|
25 | +} |
|
16 | 26 | |
17 | -while ($something) echo 'hello'; |
|
27 | +while ($something) { |
|
28 | + echo 'hello'; |
|
29 | +} |
|
18 | 30 | |
19 | 31 | do { |
20 | 32 | $i--; |
21 | 33 | } while ($something); |
22 | 34 | |
23 | -if(true) |
|
35 | +if(true) { |
|
24 | 36 | $someObject->{$name}; |
37 | +} |
|
25 | 38 | |
26 | 39 | if (true) : |
27 | 40 | $foo = true; |
@@ -42,31 +55,38 @@ discard block |
||
42 | 55 | while (!$this->readLine($tokens, $tag)); |
43 | 56 | while (!$this->readLine($tokens, $tag)); //skip to end of file |
44 | 57 | |
45 | -foreach ($cookies as $cookie) |
|
58 | +foreach ($cookies as $cookie) { |
|
46 | 59 | if ($cookie->match($uri, $matchSessionCookies, $now)) |
47 | 60 | $ret[] = $cookie; |
61 | +} |
|
48 | 62 | |
49 | -foreach ($stringParade as $hit) |
|
50 | - $hitParade[] = $hit + 0; //cast to integer |
|
63 | +foreach ($stringParade as $hit) { |
|
64 | + $hitParade[] = $hit + 0; |
|
65 | +} |
|
66 | +//cast to integer |
|
51 | 67 | |
52 | 68 | if ($foo) : |
53 | 69 | echo 'true'; |
54 | 70 | elseif ($something) : |
55 | 71 | echo 'foo'; |
56 | -else: |
|
72 | +else { |
|
73 | + : |
|
57 | 74 | echo 'false'; |
75 | +} |
|
58 | 76 | endif; |
59 | 77 | |
60 | 78 | function test() |
61 | 79 | { |
62 | - if ($a) |
|
63 | - $a.=' '.($b ? 'b' : ($c ? ($d ? 'd' : 'c') : '')); |
|
64 | -} |
|
80 | + if ($a) { |
|
81 | + $a.=' '.($b ? 'b' : ($c ? ($d ? 'd' : 'c') : '')); |
|
82 | + } |
|
83 | + } |
|
65 | 84 | |
66 | -if ($a) |
|
85 | +if ($a) { |
|
67 | 86 | foreach ($b as $c) { |
68 | 87 | if ($d) { |
69 | 88 | $e=$f; |
89 | +} |
|
70 | 90 | $g=$h; |
71 | 91 | } elseif ($i==0) { |
72 | 92 | $j=$k; |
@@ -75,7 +95,8 @@ discard block |
||
75 | 95 | |
76 | 96 | ?> |
77 | 97 | <div style="text-align: right;"> |
78 | - <?php if ($model->scenario == 'simple') $widget->renderPager() ?> |
|
98 | + <?php if ($model->scenario == 'simple') { |
|
99 | + $widget->renderPager() ?> |
|
79 | 100 | </div> |
80 | 101 | |
81 | 102 | <?php |
@@ -83,6 +104,7 @@ discard block |
||
83 | 104 | case Shop_Customer :: ERROR_INVALID_GENDER: ?> |
84 | 105 | Ungültiges Geschlecht! |
85 | 106 | <?php break; |
107 | +} |
|
86 | 108 | case Shop_Customer :: ERROR_EMAIL_IN_USE: ?> |
87 | 109 | Die eingetragene E-Mail-Adresse ist bereits registriert. |
88 | 110 | <?php break; |
@@ -95,8 +117,10 @@ discard block |
||
95 | 117 | echo 'foo'; |
96 | 118 | endswitch; |
97 | 119 | endif; |
98 | -else: |
|
120 | +else { |
|
121 | + : |
|
99 | 122 | echo 'foo'; |
123 | +} |
|
100 | 124 | endif; |
101 | 125 | |
102 | 126 | // ELSE IF split over multiple lines (not inline) |
@@ -117,85 +141,109 @@ discard block |
||
117 | 141 | } |
118 | 142 | |
119 | 143 | $stuff = [1,2,3]; |
120 | -foreach($stuff as $num) |
|
144 | +foreach($stuff as $num) { |
|
121 | 145 | if ($num %2 ) { |
122 | 146 | echo "even"; |
147 | +} |
|
123 | 148 | } else { |
124 | 149 | echo "odd"; |
125 | 150 | } |
126 | 151 | |
127 | 152 | $i = 0; |
128 | -foreach($stuff as $num) |
|
153 | +foreach($stuff as $num) { |
|
129 | 154 | do { |
130 | 155 | echo $i; |
156 | +} |
|
131 | 157 | $i++; |
132 | 158 | } while ($i < 5); |
133 | 159 | |
134 | -foreach($stuff as $num) |
|
160 | +foreach($stuff as $num) { |
|
135 | 161 | if (true) { |
136 | 162 | echo "true1\n"; |
163 | +} |
|
137 | 164 | } |
138 | 165 | if (true) { |
139 | 166 | echo "true2\n"; |
140 | 167 | } |
141 | 168 | |
142 | -if ($foo) echo 'foo'; |
|
143 | -elseif ($bar) echo 'bar'; |
|
144 | -else echo 'baz'; |
|
169 | +if ($foo) { |
|
170 | + echo 'foo'; |
|
171 | +} elseif ($bar) { |
|
172 | + echo 'bar'; |
|
173 | +} else { |
|
174 | + echo 'baz'; |
|
175 | +} |
|
145 | 176 | |
146 | 177 | switch ($type) { |
147 | 178 | case 1: |
148 | 179 | if ($foo) { |
149 | 180 | return true; |
150 | - } elseif ($baz) |
|
151 | - return true; |
|
152 | - else { |
|
181 | + } elseif ($baz) { |
|
182 | + return true; |
|
183 | + } else { |
|
153 | 184 | echo 'else'; |
154 | 185 | } |
155 | 186 | break; |
156 | 187 | } |
157 | 188 | |
158 | -foreach ($sql as $s) |
|
189 | +foreach ($sql as $s) { |
|
159 | 190 | if (!$this->execute) echo "<pre>",$s.";\n</pre>"; |
191 | +} |
|
160 | 192 | else { |
161 | 193 | $ok = $this->connDest->Execute($s); |
162 | - if (!$ok) |
|
163 | - if ($this->neverAbort) $ret = false; |
|
164 | - else return false; |
|
194 | + if (!$ok) { |
|
195 | + if ($this->neverAbort) $ret = false; |
|
196 | + } else { |
|
197 | + return false; |
|
198 | + } |
|
165 | 199 | } |
166 | 200 | |
167 | -if ($bar) |
|
168 | - if ($foo) echo 'hi'; // lol |
|
201 | +if ($bar) { |
|
202 | + if ($foo) echo 'hi'; |
|
203 | +} |
|
204 | +// lol |
|
169 | 205 | |
170 | -if ($level == 'district') |
|
206 | +if ($level == 'district') { |
|
171 | 207 | \DB::update(<<<EOD |
172 | 208 | some |
173 | 209 | text |
174 | 210 | here |
175 | 211 | EOD |
176 | 212 | ); |
213 | +} |
|
177 | 214 | |
178 | -if ($level == 'district') |
|
215 | +if ($level == 'district') { |
|
179 | 216 | $var = <<<EOD |
180 | 217 | some |
181 | 218 | text |
182 | 219 | here |
183 | 220 | EOD; |
221 | +} |
|
184 | 222 | |
185 | -if ($a && $a === Foo::VARIABLE && ($a === Foo::METHOD || $a === Foo::FUNCTION)) |
|
223 | +if ($a && $a === Foo::VARIABLE && ($a === Foo::METHOD || $a === Foo::FUNCTION)) { |
|
186 | 224 | echo 'hi'; |
225 | +} |
|
187 | 226 | |
188 | -$out = array_map(function ($test) { if ($test) return 1; else return 2; }, $input); // comment |
|
227 | +$out = array_map(function ($test) { if ($test) { |
|
228 | + return 1; |
|
229 | +} else { |
|
230 | + return 2; |
|
231 | +} |
|
232 | +}, $input); // comment |
|
189 | 233 | |
190 | 234 | for ($x=0;$x<5;$x++): |
191 | - if ($x) continue; |
|
192 | -endfor; |
|
235 | + if ($x) { |
|
236 | + continue; |
|
237 | + } |
|
238 | + endfor; |
|
193 | 239 | |
194 | 240 | for ($x=0;$x<5;$x++): |
195 | - if ($x) continue ?> <?php |
|
241 | + if ($x) { |
|
242 | + continue ?> <?php |
|
196 | 243 | endfor; |
244 | + } |
|
197 | 245 | |
198 | -if (true) |
|
246 | +if (true) { |
|
199 | 247 | try { |
200 | 248 | } |
201 | 249 | catch(Exception $e) { |
@@ -209,6 +257,7 @@ discard block |
||
209 | 257 | "foobarbaz" |
210 | 258 | ) |
211 | 259 | ); |
260 | +} |
|
212 | 261 | break; |
213 | 262 | } |
214 | 263 | |
@@ -219,9 +268,10 @@ discard block |
||
219 | 268 | while ($i < 10); |
220 | 269 | |
221 | 270 | if ($this) { |
222 | - if ($that) |
|
223 | - foo(${$a[$b]}); |
|
224 | -} |
|
271 | + if ($that) { |
|
272 | + foo(${$a[$b]}); |
|
273 | + } |
|
274 | + } |
|
225 | 275 | |
226 | 276 | while (!$this->readLine($tokens, $tag)); //phpcs:ignore Standard.Category.Sniff |
227 | 277 | |
@@ -229,18 +279,25 @@ discard block |
||
229 | 279 | |
230 | 280 | while (!$this->readLine($tokens, $tag)); /* comment */ |
231 | 281 | |
232 | -foreach ($stringParade as $hit) |
|
233 | - $hitParade[] = $hit + 0; // phpcs:ignore Standard.Category.Sniff |
|
282 | +foreach ($stringParade as $hit) { |
|
283 | + $hitParade[] = $hit + 0; |
|
284 | +} |
|
285 | +// phpcs:ignore Standard.Category.Sniff |
|
234 | 286 | |
235 | -if ($bar) |
|
236 | - if ($foo) echo 'hi'; /* @phpcs:ignore Standard.Category.Sniff */ |
|
287 | +if ($bar) { |
|
288 | + if ($foo) echo 'hi'; |
|
289 | +} |
|
290 | +/* @phpcs:ignore Standard.Category.Sniff */ |
|
237 | 291 | |
238 | -if (true) $callable = function () { |
|
292 | +if (true) { |
|
293 | + $callable = function () { |
|
239 | 294 | return true; |
295 | +} |
|
240 | 296 | }; |
241 | 297 | |
242 | -foreach ([] as $a) |
|
243 | -echo 'bar'; |
|
298 | +foreach ([] as $a) { |
|
299 | + echo 'bar'; |
|
300 | +} |
|
244 | 301 | { |
245 | 302 | echo 'baz'; |
246 | 303 | } |