PluginProbe
WPIDE – File Manager & Code Editor / 3.5.9
WPIDE – File Manager & Code Editor v3.5.9
3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 All 55 releases
wpide / vendor / nikic / php-parser / lib / PhpParser / Node / Expr / Closure.php

Closure.php in WPIDE – File Manager & Code Editor 3.5.9, at vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php

80 lines 2.6 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\Expr;
7 use PhpParser\Node\FunctionLike;
8
9 class Closure extends Expr implements FunctionLike
10 {
11 /** @var bool Whether the closure is static */
12 public $static;
13 /** @var bool Whether to return by reference */
14 public $byRef;
15 /** @var Node\Param[] Parameters */
16 public $params;
17 /** @var ClosureUse[] use()s */
18 public $uses;
19 /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */
20 public $returnType;
21 /** @var Node\Stmt[] Statements */
22 public $stmts;
23 /** @var Node\AttributeGroup[] PHP attribute groups */
24 public $attrGroups;
25
26 /**
27 * Constructs a lambda function node.
28 *
29 * @param array $subNodes Array of the following optional subnodes:
30 * 'static' => false : Whether the closure is static
31 * 'byRef' => false : Whether to return by reference
32 * 'params' => array(): Parameters
33 * 'uses' => array(): use()s
34 * 'returnType' => null : Return type
35 * 'stmts' => array(): Statements
36 * 'attrGroups' => array(): PHP attributes groups
37 * @param array $attributes Additional attributes
38 */
39 public function __construct(array $subNodes = [], array $attributes = []) {
40 $this->attributes = $attributes;
41 $this->static = $subNodes['static'] ?? false;
42 $this->byRef = $subNodes['byRef'] ?? false;
43 $this->params = $subNodes['params'] ?? [];
44 $this->uses = $subNodes['uses'] ?? [];
45 $returnType = $subNodes['returnType'] ?? null;
46 $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType;
47 $this->stmts = $subNodes['stmts'] ?? [];
48 $this->attrGroups = $subNodes['attrGroups'] ?? [];
49 }
50
51 public function getSubNodeNames() : array {
52 return ['attrGroups', 'static', 'byRef', 'params', 'uses', 'returnType', 'stmts'];
53 }
54
55 public function returnsByRef() : bool {
56 return $this->byRef;
57 }
58
59 public function getParams() : array {
60 return $this->params;
61 }
62
63 public function getReturnType() {
64 return $this->returnType;
65 }
66
67 /** @return Node\Stmt[] */
68 public function getStmts() : array {
69 return $this->stmts;
70 }
71
72 public function getAttrGroups() : array {
73 return $this->attrGroups;
74 }
75
76 public function getType() : string {
77 return 'Expr_Closure';
78 }
79 }
80