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 / Stmt / Function_.php

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

78 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\Stmt;
4
5 use PhpParser\Node;
6 use PhpParser\Node\FunctionLike;
7
8 class Function_ extends Node\Stmt implements FunctionLike
9 {
10 /** @var bool Whether function returns by reference */
11 public $byRef;
12 /** @var Node\Identifier Name */
13 public $name;
14 /** @var Node\Param[] Parameters */
15 public $params;
16 /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */
17 public $returnType;
18 /** @var Node\Stmt[] Statements */
19 public $stmts;
20 /** @var Node\AttributeGroup[] PHP attribute groups */
21 public $attrGroups;
22
23 /** @var Node\Name|null Namespaced name (if using NameResolver) */
24 public $namespacedName;
25
26 /**
27 * Constructs a function node.
28 *
29 * @param string|Node\Identifier $name Name
30 * @param array $subNodes Array of the following optional subnodes:
31 * 'byRef' => false : Whether to return by reference
32 * 'params' => array(): Parameters
33 * 'returnType' => null : Return type
34 * 'stmts' => array(): Statements
35 * 'attrGroups' => array(): PHP attribute groups
36 * @param array $attributes Additional attributes
37 */
38 public function __construct($name, array $subNodes = [], array $attributes = []) {
39 $this->attributes = $attributes;
40 $this->byRef = $subNodes['byRef'] ?? false;
41 $this->name = \is_string($name) ? new Node\Identifier($name) : $name;
42 $this->params = $subNodes['params'] ?? [];
43 $returnType = $subNodes['returnType'] ?? null;
44 $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType;
45 $this->stmts = $subNodes['stmts'] ?? [];
46 $this->attrGroups = $subNodes['attrGroups'] ?? [];
47 }
48
49 public function getSubNodeNames() : array {
50 return ['attrGroups', 'byRef', 'name', 'params', 'returnType', 'stmts'];
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 /** @return Node\Stmt[] */
70 public function getStmts() : array {
71 return $this->stmts;
72 }
73
74 public function getType() : string {
75 return 'Stmt_Function';
76 }
77 }
78