comparison vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.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 Blockless statements for if/for/etc
2 -----
3 <?php
4
5 if ($a) $A;
6 elseif ($b) $B;
7 else $C;
8
9 for (;;) $foo;
10
11 foreach ($a as $b) $AB;
12
13 while ($a) $A;
14
15 do $A; while ($a);
16
17 declare (a='b') $C;
18 -----
19 array(
20 0: Stmt_If(
21 cond: Expr_Variable(
22 name: a
23 )
24 stmts: array(
25 0: Expr_Variable(
26 name: A
27 )
28 )
29 elseifs: array(
30 0: Stmt_ElseIf(
31 cond: Expr_Variable(
32 name: b
33 )
34 stmts: array(
35 0: Expr_Variable(
36 name: B
37 )
38 )
39 )
40 )
41 else: Stmt_Else(
42 stmts: array(
43 0: Expr_Variable(
44 name: C
45 )
46 )
47 )
48 )
49 1: Stmt_For(
50 init: array(
51 )
52 cond: array(
53 )
54 loop: array(
55 )
56 stmts: array(
57 0: Expr_Variable(
58 name: foo
59 )
60 )
61 )
62 2: Stmt_Foreach(
63 expr: Expr_Variable(
64 name: a
65 )
66 keyVar: null
67 byRef: false
68 valueVar: Expr_Variable(
69 name: b
70 )
71 stmts: array(
72 0: Expr_Variable(
73 name: AB
74 )
75 )
76 )
77 3: Stmt_While(
78 cond: Expr_Variable(
79 name: a
80 )
81 stmts: array(
82 0: Expr_Variable(
83 name: A
84 )
85 )
86 )
87 4: Stmt_Do(
88 cond: Expr_Variable(
89 name: a
90 )
91 stmts: array(
92 0: Expr_Variable(
93 name: A
94 )
95 )
96 )
97 5: Stmt_Declare(
98 declares: array(
99 0: Stmt_DeclareDeclare(
100 key: a
101 value: Scalar_String(
102 value: b
103 )
104 )
105 )
106 stmts: array(
107 0: Expr_Variable(
108 name: C
109 )
110 )
111 )
112 )