Security update for Core, with self-updated composer
[yaffs-website] / vendor / nikic / php-parser / test / code / parser / stmt / class / anonymous.test
1 Anonymous classes
2 -----
3 <?php
4
5 new class {
6     public function test() {}
7 };
8 new class extends A implements B, C {};
9 new class() {
10     public $foo;
11 };
12 new class($a, $b) extends A {
13     use T;
14 };
15
16 class A {
17     public function test() {
18         return new class($this) extends A {
19             const A = 'B';
20         };
21     }
22 }
23 -----
24 array(
25     0: Expr_New(
26         class: Stmt_Class(
27             flags: 0
28             name: null
29             extends: null
30             implements: array(
31             )
32             stmts: array(
33                 0: Stmt_ClassMethod(
34                     flags: MODIFIER_PUBLIC (1)
35                     byRef: false
36                     name: test
37                     params: array(
38                     )
39                     returnType: null
40                     stmts: array(
41                     )
42                 )
43             )
44         )
45         args: array(
46         )
47     )
48     1: Expr_New(
49         class: Stmt_Class(
50             flags: 0
51             name: null
52             extends: Name(
53                 parts: array(
54                     0: A
55                 )
56             )
57             implements: array(
58                 0: Name(
59                     parts: array(
60                         0: B
61                     )
62                 )
63                 1: Name(
64                     parts: array(
65                         0: C
66                     )
67                 )
68             )
69             stmts: array(
70             )
71         )
72         args: array(
73         )
74     )
75     2: Expr_New(
76         class: Stmt_Class(
77             flags: 0
78             name: null
79             extends: null
80             implements: array(
81             )
82             stmts: array(
83                 0: Stmt_Property(
84                     flags: MODIFIER_PUBLIC (1)
85                     props: array(
86                         0: Stmt_PropertyProperty(
87                             name: foo
88                             default: null
89                         )
90                     )
91                 )
92             )
93         )
94         args: array(
95         )
96     )
97     3: Expr_New(
98         class: Stmt_Class(
99             flags: 0
100             name: null
101             extends: Name(
102                 parts: array(
103                     0: A
104                 )
105             )
106             implements: array(
107             )
108             stmts: array(
109                 0: Stmt_TraitUse(
110                     traits: array(
111                         0: Name(
112                             parts: array(
113                                 0: T
114                             )
115                         )
116                     )
117                     adaptations: array(
118                     )
119                 )
120             )
121         )
122         args: array(
123             0: Arg(
124                 value: Expr_Variable(
125                     name: a
126                 )
127                 byRef: false
128                 unpack: false
129             )
130             1: Arg(
131                 value: Expr_Variable(
132                     name: b
133                 )
134                 byRef: false
135                 unpack: false
136             )
137         )
138     )
139     4: Stmt_Class(
140         flags: 0
141         name: A
142         extends: null
143         implements: array(
144         )
145         stmts: array(
146             0: Stmt_ClassMethod(
147                 flags: MODIFIER_PUBLIC (1)
148                 byRef: false
149                 name: test
150                 params: array(
151                 )
152                 returnType: null
153                 stmts: array(
154                     0: Stmt_Return(
155                         expr: Expr_New(
156                             class: Stmt_Class(
157                                 flags: 0
158                                 name: null
159                                 extends: Name(
160                                     parts: array(
161                                         0: A
162                                     )
163                                 )
164                                 implements: array(
165                                 )
166                                 stmts: array(
167                                     0: Stmt_ClassConst(
168                                         flags: 0
169                                         consts: array(
170                                             0: Const(
171                                                 name: A
172                                                 value: Scalar_String(
173                                                     value: B
174                                                 )
175                                             )
176                                         )
177                                     )
178                                 )
179                             )
180                             args: array(
181                                 0: Arg(
182                                     value: Expr_Variable(
183                                         name: this
184                                     )
185                                     byRef: false
186                                     unpack: false
187                                 )
188                             )
189                         )
190                     )
191                 )
192             )
193         )
194     )
195 )