1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-13 01:47:22 +01:00
PHP-Parser/lib/PhpParser/Node/Stmt/UseUse.php

40 lines
1.2 KiB
PHP
Raw Normal View History

2011-06-05 18:40:04 +02:00
<?php
namespace PhpParser\Node\Stmt;
use PhpParser\Node;
use PhpParser\Node\Identifier;
class UseUse extends Node\Stmt
2011-06-05 18:40:04 +02:00
{
2015-06-13 11:27:38 +02:00
/** @var int One of the Stmt\Use_::TYPE_* constants. Will only differ from TYPE_UNKNOWN for mixed group uses */
public $type;
/** @var Node\Name Namespace, class, function or constant to alias */
public $name;
/** @var Identifier Alias */
public $alias;
2011-10-15 19:28:15 +02:00
/**
* Constructs an alias (use) node.
*
* @param Node\Name $name Namespace/Class to alias
* @param null|string|Identifier $alias Alias
* @param int $type Type of the use element (for mixed group use only)
* @param array $attributes Additional attributes
2011-10-15 19:28:15 +02:00
*/
2015-06-13 11:27:38 +02:00
public function __construct(Node\Name $name, $alias = null, $type = Use_::TYPE_UNKNOWN, array $attributes = array()) {
2011-10-15 19:28:15 +02:00
if (null === $alias) {
$alias = $name->getLast();
}
2015-05-02 22:17:34 +02:00
parent::__construct($attributes);
2015-06-13 11:27:38 +02:00
$this->type = $type;
$this->name = $name;
$this->alias = \is_string($alias) ? new Identifier($alias) : $alias;
}
public function getSubNodeNames() {
2015-06-13 11:27:38 +02:00
return array('type', 'name', 'alias');
}
}