1: | <?php declare(strict_types=1); |
2: | |
3: | namespace PhpParser\Node\Expr; |
4: | |
5: | use PhpParser\Node; |
6: | use PhpParser\Node\ClosureUse; |
7: | use PhpParser\Node\Expr; |
8: | use PhpParser\Node\FunctionLike; |
9: | |
10: | class Closure extends Expr implements FunctionLike { |
11: | |
12: | public bool $static; |
13: | |
14: | public bool $byRef; |
15: | |
16: | public array $params; |
17: | |
18: | public array $uses; |
19: | |
20: | public ?Node $returnType; |
21: | |
22: | public array $stmts; |
23: | |
24: | public array $attrGroups; |
25: | |
26: | |
27: | |
28: | |
29: | |
30: | |
31: | |
32: | |
33: | |
34: | |
35: | |
36: | |
37: | |
38: | |
39: | |
40: | |
41: | |
42: | |
43: | |
44: | |
45: | |
46: | |
47: | public function __construct(array $subNodes = [], array $attributes = []) { |
48: | $this->attributes = $attributes; |
49: | $this->static = $subNodes['static'] ?? false; |
50: | $this->byRef = $subNodes['byRef'] ?? false; |
51: | $this->params = $subNodes['params'] ?? []; |
52: | $this->uses = $subNodes['uses'] ?? []; |
53: | $this->returnType = $subNodes['returnType'] ?? null; |
54: | $this->stmts = $subNodes['stmts'] ?? []; |
55: | $this->attrGroups = $subNodes['attrGroups'] ?? []; |
56: | } |
57: | |
58: | public function getSubNodeNames(): array { |
59: | return ['attrGroups', 'static', 'byRef', 'params', 'uses', 'returnType', 'stmts']; |
60: | } |
61: | |
62: | public function returnsByRef(): bool { |
63: | return $this->byRef; |
64: | } |
65: | |
66: | public function getParams(): array { |
67: | return $this->params; |
68: | } |
69: | |
70: | public function getReturnType() { |
71: | return $this->returnType; |
72: | } |
73: | |
74: | |
75: | public function getStmts(): array { |
76: | return $this->stmts; |
77: | } |
78: | |
79: | public function getAttrGroups(): array { |
80: | return $this->attrGroups; |
81: | } |
82: | |
83: | public function getType(): string { |
84: | return 'Expr_Closure'; |
85: | } |
86: | } |
87: | |