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

23 lines
702 B
PHP
Raw Normal View History

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
* @property string $alias Alias
2011-06-05 18:40:04 +02:00
*/
class PHPParser_Node_Stmt_UseUse extends PHPParser_Node_Stmt
{
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
}