Handle group use declarations in DocBlockParser (#166)
parent
5213940064
commit
429114ff97
|
@ -26,6 +26,13 @@ class DocBlockParser extends NodeVisitorAbstract
|
|||
*/
|
||||
private $namespace;
|
||||
|
||||
/**
|
||||
* Prefix from a parent group use declaration
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $prefix;
|
||||
|
||||
/**
|
||||
* Namespace aliases in the current context
|
||||
*
|
||||
|
@ -46,6 +53,7 @@ class DocBlockParser extends NodeVisitorAbstract
|
|||
public function beforeTraverse(array $nodes)
|
||||
{
|
||||
$this->namespace = '';
|
||||
$this->prefix = '';
|
||||
$this->aliases = [];
|
||||
}
|
||||
|
||||
|
@ -53,8 +61,10 @@ class DocBlockParser extends NodeVisitorAbstract
|
|||
{
|
||||
if ($node instanceof Node\Stmt\Namespace_) {
|
||||
$this->namespace = (string)$node->name;
|
||||
} else if ($node instanceof Node\Stmt\GroupUse) {
|
||||
$this->prefix = (string)$node->prefix . '\\';
|
||||
} else if ($node instanceof Node\Stmt\UseUse) {
|
||||
$this->aliases[(string)$node->name] = $node->alias;
|
||||
$this->aliases[$node->alias] = $this->prefix . (string)$node->name;
|
||||
}
|
||||
$docComment = $node->getDocComment();
|
||||
if ($docComment === null) {
|
||||
|
@ -79,6 +89,8 @@ class DocBlockParser extends NodeVisitorAbstract
|
|||
if ($node instanceof Node\Stmt\Namespace_) {
|
||||
$this->namespace = '';
|
||||
$this->aliases = [];
|
||||
} else if ($node instanceof Node\Stmt\GroupUse) {
|
||||
$this->prefix = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue