1Yield operator precedence
2-----
3<?php
4
5function gen() {
6    yield "a" . "b";
7    yield "a" or die;
8    yield "k" => "a" . "b";
9    yield "k" => "a" or die;
10    var_dump([yield "k" => "a" . "b"]);
11    yield yield "k1" => yield "k2" => "a" . "b";
12    yield yield "k1" => (yield "k2") => "a" . "b";
13    var_dump([yield "k1" => yield "k2" => "a" . "b"]);
14    var_dump([yield "k1" => (yield "k2") => "a" . "b"]);
15}
16-----
17array(
18    0: Stmt_Function(
19        attrGroups: array(
20        )
21        byRef: false
22        name: Identifier(
23            name: gen
24        )
25        params: array(
26        )
27        returnType: null
28        stmts: array(
29            0: Stmt_Expression(
30                expr: Expr_Yield(
31                    key: null
32                    value: Expr_BinaryOp_Concat(
33                        left: Scalar_String(
34                            value: a
35                        )
36                        right: Scalar_String(
37                            value: b
38                        )
39                    )
40                )
41            )
42            1: Stmt_Expression(
43                expr: Expr_BinaryOp_LogicalOr(
44                    left: Expr_Yield(
45                        key: null
46                        value: Scalar_String(
47                            value: a
48                        )
49                    )
50                    right: Expr_Exit(
51                        expr: null
52                    )
53                )
54            )
55            2: Stmt_Expression(
56                expr: Expr_Yield(
57                    key: Scalar_String(
58                        value: k
59                    )
60                    value: Expr_BinaryOp_Concat(
61                        left: Scalar_String(
62                            value: a
63                        )
64                        right: Scalar_String(
65                            value: b
66                        )
67                    )
68                )
69            )
70            3: Stmt_Expression(
71                expr: Expr_BinaryOp_LogicalOr(
72                    left: Expr_Yield(
73                        key: Scalar_String(
74                            value: k
75                        )
76                        value: Scalar_String(
77                            value: a
78                        )
79                    )
80                    right: Expr_Exit(
81                        expr: null
82                    )
83                )
84            )
85            4: Stmt_Expression(
86                expr: Expr_FuncCall(
87                    name: Name(
88                        name: var_dump
89                    )
90                    args: array(
91                        0: Arg(
92                            name: null
93                            value: Expr_Array(
94                                items: array(
95                                    0: ArrayItem(
96                                        key: null
97                                        value: Expr_Yield(
98                                            key: Scalar_String(
99                                                value: k
100                                            )
101                                            value: Expr_BinaryOp_Concat(
102                                                left: Scalar_String(
103                                                    value: a
104                                                )
105                                                right: Scalar_String(
106                                                    value: b
107                                                )
108                                            )
109                                        )
110                                        byRef: false
111                                        unpack: false
112                                    )
113                                )
114                            )
115                            byRef: false
116                            unpack: false
117                        )
118                    )
119                )
120            )
121            5: Stmt_Expression(
122                expr: Expr_Yield(
123                    key: null
124                    value: Expr_Yield(
125                        key: Scalar_String(
126                            value: k1
127                        )
128                        value: Expr_Yield(
129                            key: Scalar_String(
130                                value: k2
131                            )
132                            value: Expr_BinaryOp_Concat(
133                                left: Scalar_String(
134                                    value: a
135                                )
136                                right: Scalar_String(
137                                    value: b
138                                )
139                            )
140                        )
141                    )
142                )
143            )
144            6: Stmt_Expression(
145                expr: Expr_Yield(
146                    key: Expr_Yield(
147                        key: Scalar_String(
148                            value: k1
149                        )
150                        value: Expr_Yield(
151                            key: null
152                            value: Scalar_String(
153                                value: k2
154                            )
155                        )
156                    )
157                    value: Expr_BinaryOp_Concat(
158                        left: Scalar_String(
159                            value: a
160                        )
161                        right: Scalar_String(
162                            value: b
163                        )
164                    )
165                )
166            )
167            7: Stmt_Expression(
168                expr: Expr_FuncCall(
169                    name: Name(
170                        name: var_dump
171                    )
172                    args: array(
173                        0: Arg(
174                            name: null
175                            value: Expr_Array(
176                                items: array(
177                                    0: ArrayItem(
178                                        key: null
179                                        value: Expr_Yield(
180                                            key: Scalar_String(
181                                                value: k1
182                                            )
183                                            value: Expr_Yield(
184                                                key: Scalar_String(
185                                                    value: k2
186                                                )
187                                                value: Expr_BinaryOp_Concat(
188                                                    left: Scalar_String(
189                                                        value: a
190                                                    )
191                                                    right: Scalar_String(
192                                                        value: b
193                                                    )
194                                                )
195                                            )
196                                        )
197                                        byRef: false
198                                        unpack: false
199                                    )
200                                )
201                            )
202                            byRef: false
203                            unpack: false
204                        )
205                    )
206                )
207            )
208            8: Stmt_Expression(
209                expr: Expr_FuncCall(
210                    name: Name(
211                        name: var_dump
212                    )
213                    args: array(
214                        0: Arg(
215                            name: null
216                            value: Expr_Array(
217                                items: array(
218                                    0: ArrayItem(
219                                        key: Expr_Yield(
220                                            key: Scalar_String(
221                                                value: k1
222                                            )
223                                            value: Expr_Yield(
224                                                key: null
225                                                value: Scalar_String(
226                                                    value: k2
227                                                )
228                                            )
229                                        )
230                                        value: Expr_BinaryOp_Concat(
231                                            left: Scalar_String(
232                                                value: a
233                                            )
234                                            right: Scalar_String(
235                                                value: b
236                                            )
237                                        )
238                                        byRef: false
239                                        unpack: false
240                                    )
241                                )
242                            )
243                            byRef: false
244                            unpack: false
245                        )
246                    )
247                )
248            )
249        )
250    )
251)
252