mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Namespace resolution did not work as intended
The algorithm to expand a class name into a FCQN contained seevral errors. These are now gone and expansion should work as expected
This commit is contained in:
@@ -350,21 +350,12 @@ class DocBlock implements \Reflector
|
|||||||
) {
|
) {
|
||||||
$type_parts = explode('\\', $item);
|
$type_parts = explode('\\', $item);
|
||||||
|
|
||||||
// if the first part is the keyword 'namespace', replace it
|
|
||||||
// with the current namespace
|
|
||||||
if ($type_parts[0] == 'namespace') {
|
|
||||||
$type_parts[0] = $this->getNamespace();
|
|
||||||
$item = implode('\\', $type_parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the first segment is an alias; replace with full name
|
// if the first segment is an alias; replace with full name
|
||||||
if (isset($this->namespace_aliases[$type_parts[0]])) {
|
if (isset($this->namespace_aliases[$type_parts[0]])) {
|
||||||
$type_parts[0] = $this->namespace_aliases[$type_parts[0]];
|
$type_parts[0] = $this->namespace_aliases[$type_parts[0]];
|
||||||
|
|
||||||
$item = implode('\\', $type_parts);
|
$item = implode('\\', $type_parts);
|
||||||
} elseif (count($type_parts) == 1) {
|
} else {
|
||||||
// prefix the item with the namespace if there is only one
|
// otherwise prepend the current namespace
|
||||||
// part and no alias
|
|
||||||
$item = $namespace . $item;
|
$item = $namespace . $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user