Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / nikic / php-parser / test / code / parser / stmt / switch.test
1 Switch
2 -----
3 <?php
4
5 switch ($a) {
6     case 0:
7         break;
8     // Comment
9     case 1;
10     default:
11 }
12
13 // alternative syntax
14 switch ($a):
15 endswitch;
16
17 // leading semicolon
18 switch ($a) { ; }
19 switch ($a): ; endswitch;
20 -----
21 array(
22     0: Stmt_Switch(
23         cond: Expr_Variable(
24             name: a
25         )
26         cases: array(
27             0: Stmt_Case(
28                 cond: Scalar_LNumber(
29                     value: 0
30                 )
31                 stmts: array(
32                     0: Stmt_Break(
33                         num: null
34                     )
35                 )
36             )
37             1: Stmt_Case(
38                 cond: Scalar_LNumber(
39                     value: 1
40                 )
41                 stmts: array(
42                 )
43                 comments: array(
44                     0: // Comment
45                 )
46             )
47             2: Stmt_Case(
48                 cond: null
49                 stmts: array(
50                 )
51             )
52         )
53     )
54     1: Stmt_Switch(
55         cond: Expr_Variable(
56             name: a
57         )
58         cases: array(
59         )
60         comments: array(
61             0: // alternative syntax
62         )
63     )
64     2: Stmt_Switch(
65         cond: Expr_Variable(
66             name: a
67         )
68         cases: array(
69         )
70         comments: array(
71             0: // leading semicolon
72         )
73     )
74     3: Stmt_Switch(
75         cond: Expr_Variable(
76             name: a
77         )
78         cases: array(
79         )
80     )
81 )