2011-06-05 18:40:04 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2011-08-04 12:01:03 +02:00
|
|
|
* @property PHPParser_Node_Name $name Namespace/Class to alias
|
2011-08-04 12:58:12 +02:00
|
|
|
* @property string $alias Alias
|
2011-06-05 18:40:04 +02:00
|
|
|
*/
|
|
|
|
class PHPParser_Node_Stmt_UseUse extends PHPParser_Node_Stmt
|
|
|
|
{
|
2011-08-04 12:58:12 +02:00
|
|
|
public function __construct(array $subNodes, $line = -1, $docComment = null) {
|
|
|
|
parent::__construct($subNodes, $line, $docComment);
|
|
|
|
|
|
|
|
if (null === $this->alias) {
|
|
|
|
$this->alias = $this->name->getLast();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ('self' == $this->alias || 'parent' == $this->alias) {
|
|
|
|
throw new PHPParser_Error(sprintf(
|
|
|
|
'Cannot use "%s" as "%s" because "%2$s" is a special class name',
|
|
|
|
$this->name, $this->alias
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
2011-06-05 18:40:04 +02:00
|
|
|
}
|