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