Mercurial > hg > isophonics-drupal-site
comparison vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.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\Node\Stmt; | 3 namespace PhpParser\Node\Stmt; |
4 | 4 |
5 use PhpParser\Node; | 5 use PhpParser\Node; |
6 use PhpParser\Node\Identifier; | |
6 | 7 |
7 class UseUse extends Node\Stmt | 8 class UseUse extends Node\Stmt |
8 { | 9 { |
9 /** @var int One of the Stmt\Use_::TYPE_* constants. Will only differ from TYPE_UNKNOWN for mixed group uses */ | 10 /** @var int One of the Stmt\Use_::TYPE_* constants. Will only differ from TYPE_UNKNOWN for mixed group uses */ |
10 public $type; | 11 public $type; |
11 /** @var Node\Name Namespace, class, function or constant to alias */ | 12 /** @var Node\Name Namespace, class, function or constant to alias */ |
12 public $name; | 13 public $name; |
13 /** @var string Alias */ | 14 /** @var Identifier|null Alias */ |
14 public $alias; | 15 public $alias; |
15 | 16 |
16 /** | 17 /** |
17 * Constructs an alias (use) node. | 18 * Constructs an alias (use) node. |
18 * | 19 * |
19 * @param Node\Name $name Namespace/Class to alias | 20 * @param Node\Name $name Namespace/Class to alias |
20 * @param null|string $alias Alias | 21 * @param null|string|Identifier $alias Alias |
21 * @param int $type Type of the use element (for mixed group use declarations only) | 22 * @param int $type Type of the use element (for mixed group use only) |
22 * @param array $attributes Additional attributes | 23 * @param array $attributes Additional attributes |
23 */ | 24 */ |
24 public function __construct(Node\Name $name, $alias = null, $type = Use_::TYPE_UNKNOWN, array $attributes = array()) { | 25 public function __construct(Node\Name $name, $alias = null, int $type = Use_::TYPE_UNKNOWN, array $attributes = []) { |
25 if (null === $alias) { | |
26 $alias = $name->getLast(); | |
27 } | |
28 | |
29 parent::__construct($attributes); | 26 parent::__construct($attributes); |
30 $this->type = $type; | 27 $this->type = $type; |
31 $this->name = $name; | 28 $this->name = $name; |
32 $this->alias = $alias; | 29 $this->alias = \is_string($alias) ? new Identifier($alias) : $alias; |
33 } | 30 } |
34 | 31 |
35 public function getSubNodeNames() { | 32 public function getSubNodeNames() : array { |
36 return array('type', 'name', 'alias'); | 33 return ['type', 'name', 'alias']; |
34 } | |
35 | |
36 /** | |
37 * Get alias. If not explicitly given this is the last component of the used name. | |
38 * | |
39 * @return Identifier | |
40 */ | |
41 public function getAlias() : Identifier { | |
42 if (null !== $this->alias) { | |
43 return $this->alias; | |
44 } | |
45 | |
46 return new Identifier($this->name->getLast()); | |
47 } | |
48 | |
49 public function getType() : string { | |
50 return 'Stmt_UseUse'; | |
37 } | 51 } |
38 } | 52 } |