2011-06-05 18:40:04 +02:00
|
|
|
<?php
|
|
|
|
|
2014-02-06 14:44:16 +01:00
|
|
|
namespace PhpParser\Node\Stmt;
|
|
|
|
|
|
|
|
use PhpParser\Node;
|
|
|
|
use PhpParser\Error;
|
|
|
|
|
|
|
|
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;
|
2015-02-28 18:44:28 +01:00
|
|
|
/** @var Node\Name Namespace, class, function or constant to alias */
|
|
|
|
public $name;
|
|
|
|
/** @var string Alias */
|
|
|
|
public $alias;
|
|
|
|
|
2011-10-15 19:28:15 +02:00
|
|
|
/**
|
|
|
|
* Constructs an alias (use) node.
|
|
|
|
*
|
2014-02-06 14:44:16 +01:00
|
|
|
* @param Node\Name $name Namespace/Class to alias
|
|
|
|
* @param null|string $alias Alias
|
2015-06-13 11:27:38 +02:00
|
|
|
* @param int $type Type of the use element (for mixed group use declarations only)
|
2014-02-06 14:44:16 +01:00
|
|
|
* @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();
|
2011-08-04 12:58:12 +02:00
|
|
|
}
|
|
|
|
|
2015-05-02 22:17:34 +02:00
|
|
|
parent::__construct($attributes);
|
2015-06-13 11:27:38 +02:00
|
|
|
$this->type = $type;
|
2015-02-28 18:44:28 +01:00
|
|
|
$this->name = $name;
|
|
|
|
$this->alias = $alias;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSubNodeNames() {
|
2015-06-13 11:27:38 +02:00
|
|
|
return array('type', 'name', 'alias');
|
2011-08-04 12:58:12 +02:00
|
|
|
}
|
2014-01-23 13:33:02 +01:00
|
|
|
}
|