PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / 0.4.2
Code Engine – PHP Snippets, AI Functions & Automation for WordPress v0.4.2
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 / ArrowFunction.php

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

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