PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / 0.5.1
Code Engine – PHP Snippets, AI Functions & Automation for WordPress v0.5.1
0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 trunk 0.0.1 0.0.2 0.2.8 0.2.9 0.3.0 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 All 33 releases
code-engine / vendor / nikic / php-parser / lib / PhpParser / Node / Expr / Closure.php

Closure.php in Code Engine – PHP Snippets, AI Functions & Automation for WordPress 0.5.1, at vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php

87 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 /** @var bool Whether the closure is static */
12 public bool $static;
13 /** @var bool Whether to return by reference */
14 public bool $byRef;
15 /** @var Node\Param[] Parameters */
16 public array $params;
17 /** @var ClosureUse[] use()s */
18 public array $uses;
19 /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */
20 public ?Node $returnType;
21 /** @var Node\Stmt[] Statements */
22 public array $stmts;
23 /** @var Node\AttributeGroup[] PHP attribute groups */
24 public array $attrGroups;
25
26 /**
27 * Constructs a lambda function node.
28 *
29 * @param array{
30 * static?: bool,
31 * byRef?: bool,
32 * params?: Node\Param[],
33 * uses?: ClosureUse[],
34 * returnType?: null|Node\Identifier|Node\Name|Node\ComplexType,
35 * stmts?: Node\Stmt[],
36 * attrGroups?: Node\AttributeGroup[],
37 * } $subNodes Array of the following optional subnodes:
38 * 'static' => false : Whether the closure is static
39 * 'byRef' => false : Whether to return by reference
40 * 'params' => array(): Parameters
41 * 'uses' => array(): use()s
42 * 'returnType' => null : Return type
43 * 'stmts' => array(): Statements
44 * 'attrGroups' => array(): PHP attributes groups
45 * @param array<string, mixed> $attributes Additional attributes
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 /** @return Node\Stmt[] */
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