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 / ArrowFunction.php

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

80 lines 2.3 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 ArrowFunction extends Expr implements FunctionLike
10 {
11 /** @var bool */
12 public $static;
13
14 /** @var bool */
15 public $byRef;
16
17 /** @var Node\Param[] */
18 public $params = [];
19
20 /** @var null|Node\Identifier|Node\Name|Node\ComplexType */
21 public $returnType;
22
23 /** @var Expr */
24 public $expr;
25 /** @var Node\AttributeGroup[] */
26 public $attrGroups;
27
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 * 'returnType' => null : Return type
34 * 'expr' => Expr : Expression body
35 * 'attrGroups' => array() : PHP attribute groups
36 * @param array $attributes Additional attributes
37 */
38 public function __construct(array $subNodes = [], array $attributes = []) {
39 $this->attributes = $attributes;
40 $this->static = $subNodes['static'] ?? false;
41 $this->byRef = $subNodes['byRef'] ?? false;
42 $this->params = $subNodes['params'] ?? [];
43 $returnType = $subNodes['returnType'] ?? null;
44 $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType;
45 $this->expr = $subNodes['expr'];
46 $this->attrGroups = $subNodes['attrGroups'] ?? [];
47 }
48
49 public function getSubNodeNames() : array {
50 return ['attrGroups', 'static', 'byRef', 'params', 'returnType', 'expr'];
51 }
52
53 public function returnsByRef() : bool {
54 return $this->byRef;
55 }
56
57 public function getParams() : array {
58 return $this->params;
59 }
60
61 public function getReturnType() {
62 return $this->returnType;
63 }
64
65 public function getAttrGroups() : array {
66 return $this->attrGroups;
67 }
68
69 /**
70 * @return Node\Stmt\Return_[]
71 */
72 public function getStmts() : array {
73 return [new Node\Stmt\Return_($this->expr)];
74 }
75
76 public function getType() : string {
77 return 'Expr_ArrowFunction';
78 }
79 }
80