Mercurial > hg > isophonics-drupal-site
comparison vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
12:7a779792577d | 13:5fb285c0d0e3 |
---|---|
1 <?php | 1 <?php declare(strict_types=1); |
2 | 2 |
3 namespace PhpParser\Builder; | 3 namespace PhpParser\Builder; |
4 | 4 |
5 use PhpParser; | 5 use PhpParser; |
6 use PhpParser\BuilderHelpers; | |
6 use PhpParser\Node; | 7 use PhpParser\Node; |
7 use PhpParser\Node\Stmt; | 8 use PhpParser\Node\Stmt; |
8 | 9 |
9 class Function_ extends FunctionLike | 10 class Function_ extends FunctionLike |
10 { | 11 { |
11 protected $name; | 12 protected $name; |
12 protected $stmts = array(); | 13 protected $stmts = []; |
13 | 14 |
14 /** | 15 /** |
15 * Creates a function builder. | 16 * Creates a function builder. |
16 * | 17 * |
17 * @param string $name Name of the function | 18 * @param string $name Name of the function |
18 */ | 19 */ |
19 public function __construct($name) { | 20 public function __construct(string $name) { |
20 $this->name = $name; | 21 $this->name = $name; |
21 } | 22 } |
22 | 23 |
23 /** | 24 /** |
24 * Adds a statement. | 25 * Adds a statement. |
26 * @param Node|PhpParser\Builder $stmt The statement to add | 27 * @param Node|PhpParser\Builder $stmt The statement to add |
27 * | 28 * |
28 * @return $this The builder instance (for fluid interface) | 29 * @return $this The builder instance (for fluid interface) |
29 */ | 30 */ |
30 public function addStmt($stmt) { | 31 public function addStmt($stmt) { |
31 $this->stmts[] = $this->normalizeNode($stmt); | 32 $this->stmts[] = BuilderHelpers::normalizeStmt($stmt); |
32 | 33 |
33 return $this; | 34 return $this; |
34 } | 35 } |
35 | 36 |
36 /** | 37 /** |
37 * Returns the built function node. | 38 * Returns the built function node. |
38 * | 39 * |
39 * @return Stmt\Function_ The built function node | 40 * @return Stmt\Function_ The built function node |
40 */ | 41 */ |
41 public function getNode() { | 42 public function getNode() : Node { |
42 return new Stmt\Function_($this->name, array( | 43 return new Stmt\Function_($this->name, [ |
43 'byRef' => $this->returnByRef, | 44 'byRef' => $this->returnByRef, |
44 'params' => $this->params, | 45 'params' => $this->params, |
45 'returnType' => $this->returnType, | 46 'returnType' => $this->returnType, |
46 'stmts' => $this->stmts, | 47 'stmts' => $this->stmts, |
47 ), $this->attributes); | 48 ], $this->attributes); |
48 } | 49 } |
49 } | 50 } |