5a1fd3fc59e7625f5235a20f093ed76bb2c92de1
[yaffs-website] / vendor / nikic / php-parser / test / code / parser / stmt / class / modifier.test
1 Invalid modifier combination
2 -----
3 <?php class A { public public $a; }
4 -----
5 Multiple access type modifiers are not allowed from 1:24 to 1:29
6 array(
7     0: Stmt_Class(
8         flags: 0
9         name: A
10         extends: null
11         implements: array(
12         )
13         stmts: array(
14             0: Stmt_Property(
15                 flags: MODIFIER_PUBLIC (1)
16                 props: array(
17                     0: Stmt_PropertyProperty(
18                         name: a
19                         default: null
20                     )
21                 )
22             )
23         )
24     )
25 )
26 -----
27 <?php class A { public protected $a; }
28 -----
29 Multiple access type modifiers are not allowed from 1:24 to 1:32
30 array(
31     0: Stmt_Class(
32         flags: 0
33         name: A
34         extends: null
35         implements: array(
36         )
37         stmts: array(
38             0: Stmt_Property(
39                 flags: MODIFIER_PUBLIC | MODIFIER_PROTECTED (3)
40                 props: array(
41                     0: Stmt_PropertyProperty(
42                         name: a
43                         default: null
44                     )
45                 )
46             )
47         )
48     )
49 )
50 -----
51 <?php class A { abstract abstract function a(); }
52 -----
53 Multiple abstract modifiers are not allowed from 1:26 to 1:33
54 array(
55     0: Stmt_Class(
56         flags: 0
57         name: A
58         extends: null
59         implements: array(
60         )
61         stmts: array(
62             0: Stmt_ClassMethod(
63                 flags: MODIFIER_ABSTRACT (16)
64                 byRef: false
65                 name: a
66                 params: array(
67                 )
68                 returnType: null
69                 stmts: null
70             )
71         )
72     )
73 )
74 -----
75 <?php class A { static static $a; }
76 -----
77 Multiple static modifiers are not allowed from 1:24 to 1:29
78 array(
79     0: Stmt_Class(
80         flags: 0
81         name: A
82         extends: null
83         implements: array(
84         )
85         stmts: array(
86             0: Stmt_Property(
87                 flags: MODIFIER_STATIC (8)
88                 props: array(
89                     0: Stmt_PropertyProperty(
90                         name: a
91                         default: null
92                     )
93                 )
94             )
95         )
96     )
97 )
98 -----
99 <?php class A { final final function a() {} }
100 -----
101 Multiple final modifiers are not allowed from 1:23 to 1:27
102 array(
103     0: Stmt_Class(
104         flags: 0
105         name: A
106         extends: null
107         implements: array(
108         )
109         stmts: array(
110             0: Stmt_ClassMethod(
111                 flags: MODIFIER_FINAL (32)
112                 byRef: false
113                 name: a
114                 params: array(
115                 )
116                 returnType: null
117                 stmts: array(
118                 )
119             )
120         )
121     )
122 )
123 -----
124 <?php class A { abstract final function a(); }
125 -----
126 Cannot use the final modifier on an abstract class member from 1:26 to 1:30
127 array(
128     0: Stmt_Class(
129         flags: 0
130         name: A
131         extends: null
132         implements: array(
133         )
134         stmts: array(
135             0: Stmt_ClassMethod(
136                 flags: MODIFIER_ABSTRACT | MODIFIER_FINAL (48)
137                 byRef: false
138                 name: a
139                 params: array(
140                 )
141                 returnType: null
142                 stmts: null
143             )
144         )
145     )
146 )
147 -----
148 <?php abstract final class A { }
149 // Type in the partial parse could conceivably be any of 0, 16 or 32
150 -----
151 Syntax error, unexpected T_FINAL, expecting T_CLASS from 1:16 to 1:20
152 array(
153     0: Stmt_Class(
154         flags: MODIFIER_FINAL (32)
155         name: A
156         extends: null
157         implements: array(
158         )
159         stmts: array(
160         )
161     )
162     1: Stmt_Nop(
163         comments: array(
164             0: // Type in the partial parse could conceivably be any of 0, 16 or 32
165         )
166     )
167 )
168 -----
169 <?php class A { abstract $a; }
170 -----
171 Properties cannot be declared abstract from 1:17 to 1:24
172 array(
173     0: Stmt_Class(
174         flags: 0
175         name: A
176         extends: null
177         implements: array(
178         )
179         stmts: array(
180             0: Stmt_Property(
181                 flags: MODIFIER_ABSTRACT (16)
182                 props: array(
183                     0: Stmt_PropertyProperty(
184                         name: a
185                         default: null
186                     )
187                 )
188             )
189         )
190     )
191 )
192 -----
193 <?php class A { final $a; }
194 -----
195 Properties cannot be declared final from 1:17 to 1:21
196 array(
197     0: Stmt_Class(
198         flags: 0
199         name: A
200         extends: null
201         implements: array(
202         )
203         stmts: array(
204             0: Stmt_Property(
205                 flags: MODIFIER_FINAL (32)
206                 props: array(
207                     0: Stmt_PropertyProperty(
208                         name: a
209                         default: null
210                     )
211                 )
212             )
213         )
214     )
215 )