mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 18:13:13 +00:00
fix for bug #1672 in phpDocumentor2
When dealing with inline @see or @link tags and having a relative method or property type like LinkDescriptor::setLink() and a namespace alias like phpDocumentor\Descriptor\Tag\LinkDescriptor Collection::expand() was checking if LinkDescriptor::setLink() could be found in the namespace aliases. This would never be true. In this fix, the method or type (for instance ::setLink()) part is removed for comparison and later re-added when generating the full name
This commit is contained in:
@@ -161,7 +161,8 @@ class Collection extends \ArrayObject
|
||||
$namespace_aliases = $this->context->getNamespaceAliases();
|
||||
// if the first segment is not an alias; prepend namespace name and
|
||||
// return
|
||||
if (!isset($namespace_aliases[$type_parts[0]])) {
|
||||
if (!isset($namespace_aliases[$type_parts[0]]) &&
|
||||
!isset($namespace_aliases[strstr($type_parts[0], '::', true)])) {
|
||||
$namespace = $this->context->getNamespace();
|
||||
if ('' !== $namespace) {
|
||||
$namespace .= self::OPERATOR_NAMESPACE;
|
||||
@@ -169,6 +170,12 @@ class Collection extends \ArrayObject
|
||||
return self::OPERATOR_NAMESPACE . $namespace . $type;
|
||||
}
|
||||
|
||||
if (strpos($type_parts[0], '::')) {
|
||||
$type_parts[] = strstr($type_parts[0], '::');
|
||||
$type_parts[0] = $namespace_aliases[strstr($type_parts[0], '::', true)];
|
||||
return implode('', $type_parts);
|
||||
}
|
||||
|
||||
$type_parts[0] = $namespace_aliases[$type_parts[0]];
|
||||
$type = implode(self::OPERATOR_NAMESPACE, $type_parts);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user