Skip to content

Commit 1118e22

Browse files
committed
Add test for breaking out of match arm using continue
1 parent a0e68a1 commit 1118e22

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Zend/tests/match/020.phpt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
Test breaking out of match arm with continue
3+
--FILE--
4+
<?php
5+
6+
foreach (range(0, 9) as $i) {
7+
match ($i) {
8+
default => {
9+
echo "$i 1\n";
10+
continue;
11+
echo "$i 2\n";
12+
},
13+
}
14+
15+
echo "$i 3\n";
16+
}
17+
18+
--EXPECTF--
19+
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in %s on line %d
20+
0 1
21+
0 3
22+
1 1
23+
1 3
24+
2 1
25+
2 3
26+
3 1
27+
3 3
28+
4 1
29+
4 3
30+
5 1
31+
5 3
32+
6 1
33+
6 3
34+
7 1
35+
7 3
36+
8 1
37+
8 3
38+
9 1
39+
9 3

0 commit comments

Comments
 (0)