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

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

68 lines 1.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\Builder;
4
5 use PhpParser;
6 use PhpParser\BuilderHelpers;
7 use PhpParser\Node;
8 use PhpParser\Node\Stmt;
9
10 class Function_ extends FunctionLike
11 {
12 protected $name;
13 protected $stmts = [];
14
15 /** @var Node\AttributeGroup[] */
16 protected $attributeGroups = [];
17
18 /**
19 * Creates a function builder.
20 *
21 * @param string $name Name of the function
22 */
23 public function __construct(string $name) {
24 $this->name = $name;
25 }
26
27 /**
28 * Adds a statement.
29 *
30 * @param Node|PhpParser\Builder $stmt The statement to add
31 *
32 * @return $this The builder instance (for fluid interface)
33 */
34 public function addStmt($stmt) {
35 $this->stmts[] = BuilderHelpers::normalizeStmt($stmt);
36
37 return $this;
38 }
39
40 /**
41 * Adds an attribute group.
42 *
43 * @param Node\Attribute|Node\AttributeGroup $attribute
44 *
45 * @return $this The builder instance (for fluid interface)
46 */
47 public function addAttribute($attribute) {
48 $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
49
50 return $this;
51 }
52
53 /**
54 * Returns the built function node.
55 *
56 * @return Stmt\Function_ The built function node
57 */
58 public function getNode() : Node {
59 return new Stmt\Function_($this->name, [
60 'byRef' => $this->returnByRef,
61 'params' => $this->params,
62 'returnType' => $this->returnType,
63 'stmts' => $this->stmts,
64 'attrGroups' => $this->attributeGroups,
65 ], $this->attributes);
66 }
67 }
68