1Arrow Functions
2-----
3<?php
4fn(bool $a) => $a;
5fn($x = 42) => $x;
6static fn(&$x) => $x;
7fn&($x) => $x;
8fn($x, ...$rest) => $rest;
9fn(): int => $x;
10
11fn($a, $b) => $a and $b;
12fn($a, $b) => $a && $b;
13-----
14array(
15    0: Stmt_Expression(
16        expr: Expr_ArrowFunction(
17            attrGroups: array(
18            )
19            static: false
20            byRef: false
21            params: array(
22                0: Param(
23                    attrGroups: array(
24                    )
25                    flags: 0
26                    type: Identifier(
27                        name: bool
28                    )
29                    byRef: false
30                    variadic: false
31                    var: Expr_Variable(
32                        name: a
33                    )
34                    default: null
35                    hooks: array(
36                    )
37                )
38            )
39            returnType: null
40            expr: Expr_Variable(
41                name: a
42            )
43        )
44    )
45    1: Stmt_Expression(
46        expr: Expr_ArrowFunction(
47            attrGroups: array(
48            )
49            static: false
50            byRef: false
51            params: array(
52                0: Param(
53                    attrGroups: array(
54                    )
55                    flags: 0
56                    type: null
57                    byRef: false
58                    variadic: false
59                    var: Expr_Variable(
60                        name: x
61                    )
62                    default: Scalar_Int(
63                        value: 42
64                    )
65                    hooks: array(
66                    )
67                )
68            )
69            returnType: null
70            expr: Expr_Variable(
71                name: x
72            )
73        )
74    )
75    2: Stmt_Expression(
76        expr: Expr_ArrowFunction(
77            attrGroups: array(
78            )
79            static: true
80            byRef: false
81            params: array(
82                0: Param(
83                    attrGroups: array(
84                    )
85                    flags: 0
86                    type: null
87                    byRef: true
88                    variadic: false
89                    var: Expr_Variable(
90                        name: x
91                    )
92                    default: null
93                    hooks: array(
94                    )
95                )
96            )
97            returnType: null
98            expr: Expr_Variable(
99                name: x
100            )
101        )
102    )
103    3: Stmt_Expression(
104        expr: Expr_ArrowFunction(
105            attrGroups: array(
106            )
107            static: false
108            byRef: true
109            params: array(
110                0: Param(
111                    attrGroups: array(
112                    )
113                    flags: 0
114                    type: null
115                    byRef: false
116                    variadic: false
117                    var: Expr_Variable(
118                        name: x
119                    )
120                    default: null
121                    hooks: array(
122                    )
123                )
124            )
125            returnType: null
126            expr: Expr_Variable(
127                name: x
128            )
129        )
130    )
131    4: Stmt_Expression(
132        expr: Expr_ArrowFunction(
133            attrGroups: array(
134            )
135            static: false
136            byRef: false
137            params: array(
138                0: Param(
139                    attrGroups: array(
140                    )
141                    flags: 0
142                    type: null
143                    byRef: false
144                    variadic: false
145                    var: Expr_Variable(
146                        name: x
147                    )
148                    default: null
149                    hooks: array(
150                    )
151                )
152                1: Param(
153                    attrGroups: array(
154                    )
155                    flags: 0
156                    type: null
157                    byRef: false
158                    variadic: true
159                    var: Expr_Variable(
160                        name: rest
161                    )
162                    default: null
163                    hooks: array(
164                    )
165                )
166            )
167            returnType: null
168            expr: Expr_Variable(
169                name: rest
170            )
171        )
172    )
173    5: Stmt_Expression(
174        expr: Expr_ArrowFunction(
175            attrGroups: array(
176            )
177            static: false
178            byRef: false
179            params: array(
180            )
181            returnType: Identifier(
182                name: int
183            )
184            expr: Expr_Variable(
185                name: x
186            )
187        )
188    )
189    6: Stmt_Expression(
190        expr: Expr_ArrowFunction(
191            attrGroups: array(
192            )
193            static: false
194            byRef: false
195            params: array(
196                0: Param(
197                    attrGroups: array(
198                    )
199                    flags: 0
200                    type: null
201                    byRef: false
202                    variadic: false
203                    var: Expr_Variable(
204                        name: a
205                    )
206                    default: null
207                    hooks: array(
208                    )
209                )
210                1: Param(
211                    attrGroups: array(
212                    )
213                    flags: 0
214                    type: null
215                    byRef: false
216                    variadic: false
217                    var: Expr_Variable(
218                        name: b
219                    )
220                    default: null
221                    hooks: array(
222                    )
223                )
224            )
225            returnType: null
226            expr: Expr_BinaryOp_LogicalAnd(
227                left: Expr_Variable(
228                    name: a
229                )
230                right: Expr_Variable(
231                    name: b
232                )
233            )
234        )
235    )
236    7: Stmt_Expression(
237        expr: Expr_ArrowFunction(
238            attrGroups: array(
239            )
240            static: false
241            byRef: false
242            params: array(
243                0: Param(
244                    attrGroups: array(
245                    )
246                    flags: 0
247                    type: null
248                    byRef: false
249                    variadic: false
250                    var: Expr_Variable(
251                        name: a
252                    )
253                    default: null
254                    hooks: array(
255                    )
256                )
257                1: Param(
258                    attrGroups: array(
259                    )
260                    flags: 0
261                    type: null
262                    byRef: false
263                    variadic: false
264                    var: Expr_Variable(
265                        name: b
266                    )
267                    default: null
268                    hooks: array(
269                    )
270                )
271            )
272            returnType: null
273            expr: Expr_BinaryOp_BooleanAnd(
274                left: Expr_Variable(
275                    name: a
276                )
277                right: Expr_Variable(
278                    name: b
279                )
280            )
281        )
282    )
283)
284