comparison vendor/nikic/php-parser/test/code/parser/stmt/switch.test @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 5fb285c0d0e3
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 Switch
2 -----
3 <?php
4
5 switch ($a) {
6 case 0:
7 case 1;
8 default:
9 }
10
11 // alternative syntax
12 switch ($a):
13 endswitch;
14
15 // leading semicolon
16 switch ($a) { ; }
17 switch ($a): ; endswitch;
18 -----
19 array(
20 0: Stmt_Switch(
21 cond: Expr_Variable(
22 name: a
23 )
24 cases: array(
25 0: Stmt_Case(
26 cond: Scalar_LNumber(
27 value: 0
28 )
29 stmts: array(
30 )
31 )
32 1: Stmt_Case(
33 cond: Scalar_LNumber(
34 value: 1
35 )
36 stmts: array(
37 )
38 )
39 2: Stmt_Case(
40 cond: null
41 stmts: array(
42 )
43 )
44 )
45 )
46 1: Stmt_Switch(
47 cond: Expr_Variable(
48 name: a
49 )
50 cases: array(
51 )
52 comments: array(
53 0: // alternative syntax
54 )
55 )
56 2: Stmt_Switch(
57 cond: Expr_Variable(
58 name: a
59 )
60 cases: array(
61 )
62 comments: array(
63 0: // leading semicolon
64 )
65 )
66 3: Stmt_Switch(
67 cond: Expr_Variable(
68 name: a
69 )
70 cases: array(
71 )
72 )
73 )