comparison vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.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 Namespace_ extends Declaration 10 class Namespace_ extends Declaration
10 { 11 {
11 private $name; 12 private $name;
12 private $stmts = array(); 13 private $stmts = [];
13 14
14 /** 15 /**
15 * Creates a namespace builder. 16 * Creates a namespace builder.
16 * 17 *
17 * @param Node\Name|string|null $name Name of the namespace 18 * @param Node\Name|string|null $name Name of the namespace
18 */ 19 */
19 public function __construct($name) { 20 public function __construct($name) {
20 $this->name = null !== $name ? $this->normalizeName($name) : null; 21 $this->name = null !== $name ? BuilderHelpers::normalizeName($name) : null;
21 } 22 }
22 23
23 /** 24 /**
24 * Adds a statement. 25 * Adds a statement.
25 * 26 *
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 node. 38 * Returns the built node.
38 * 39 *
39 * @return Node The built node 40 * @return Node The built node
40 */ 41 */
41 public function getNode() { 42 public function getNode() : Node {
42 return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes); 43 return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes);
43 } 44 }
44 } 45 }