php-parser/lib/PhpParser/Node/Stmt/UseUse.php

39 lines
1.1 KiB
PHP
Raw Normal View History

2011-06-05 18:40:04 +02:00
<?php
namespace PhpParser\Node\Stmt;
use PhpParser\Node;
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 string 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 $alias Alias
2015-06-13 11:27:38 +02:00
* @param int $type Type of the use element (for mixed group use declarations 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 = $alias;
}
public function getSubNodeNames() {
2015-06-13 11:27:38 +02:00
return array('type', 'name', 'alias');
}
}