MCPcopy Create free account
hub / github.com/z7zmey/php-parser / TestYieldKeyExpr

Function TestYieldKeyExpr

node/expr/t_yield_test.go:242–307  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

240}
241
242func TestYieldKeyExpr(t *testing.T) {
243 src := `<? yield $a => 1;`
244
245 expected := &node.Root{
246 Position: &position.Position{
247 StartLine: 1,
248 EndLine: 1,
249 StartPos: 3,
250 EndPos: 17,
251 },
252 Stmts: []node.Node{
253 &stmt.Expression{
254 Position: &position.Position{
255 StartLine: 1,
256 EndLine: 1,
257 StartPos: 3,
258 EndPos: 17,
259 },
260 Expr: &expr.Yield{
261 Position: &position.Position{
262 StartLine: 1,
263 EndLine: 1,
264 StartPos: 3,
265 EndPos: 16,
266 },
267 Key: &expr.Variable{
268 Position: &position.Position{
269 StartLine: 1,
270 EndLine: 1,
271 StartPos: 9,
272 EndPos: 11,
273 },
274 VarName: &node.Identifier{
275 Position: &position.Position{
276 StartLine: 1,
277 EndLine: 1,
278 StartPos: 9,
279 EndPos: 11,
280 },
281 Value: "a",
282 },
283 },
284 Value: &scalar.Lnumber{
285 Position: &position.Position{
286 StartLine: 1,
287 EndLine: 1,
288 StartPos: 15,
289 EndPos: 16,
290 },
291 Value: "1",
292 },
293 },
294 },
295 },
296 }
297
298 php7parser := php7.NewParser([]byte(src), "7.4")
299 php7parser.Parse()

Callers

nothing calls this directly

Calls 4

ParseMethod · 0.95
GetRootNodeMethod · 0.95
NewParserFunction · 0.92
NewParserFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…