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

Function TestClosureUse

node/expr/t_closure_test.go:64–215  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestClosureUse(t *testing.T) {
65 src := `<? function($a, $b) use ($c, &$d) {};`
66
67 expected := &node.Root{
68 Position: &position.Position{
69 StartLine: 1,
70 EndLine: 1,
71 StartPos: 3,
72 EndPos: 37,
73 },
74 Stmts: []node.Node{
75 &stmt.Expression{
76 Position: &position.Position{
77 StartLine: 1,
78 EndLine: 1,
79 StartPos: 3,
80 EndPos: 37,
81 },
82 Expr: &expr.Closure{
83 Position: &position.Position{
84 StartLine: 1,
85 EndLine: 1,
86 StartPos: 3,
87 EndPos: 36,
88 },
89 ReturnsRef: false,
90 Static: false,
91 PhpDocComment: "",
92 Params: []node.Node{
93 &node.Parameter{
94 Position: &position.Position{
95 StartLine: 1,
96 EndLine: 1,
97 StartPos: 12,
98 EndPos: 14,
99 },
100 Variadic: false,
101 ByRef: false,
102 Variable: &expr.Variable{
103 Position: &position.Position{
104 StartLine: 1,
105 EndLine: 1,
106 StartPos: 12,
107 EndPos: 14,
108 },
109 VarName: &node.Identifier{
110 Position: &position.Position{
111 StartLine: 1,
112 EndLine: 1,
113 StartPos: 12,
114 EndPos: 14,
115 },
116 Value: "a",
117 },
118 },
119 },
120 &node.Parameter{
121 Position: &position.Position{

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…