Compare commits

...
Author SHA1 Message Date
Mike van Riel cee3c0bc21 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
2012-06-30 13:38:18 +02:00
Mike van Riel 731e797dd8 Added 'global' to the list of special namespace names indicating global space and adding namespace resolution to the param tags 'getType()' method 2012-06-29 23:04:12 +02:00
2 changed files with 4 additions and 13 deletions
+3 -12
View File
@@ -330,7 +330,7 @@ class DocBlock implements \Reflector
} }
$namespace = ''; $namespace = '';
if ($this->namespace != 'default') { if ($this->namespace != 'default' && $this->namespace != 'global') {
$namespace = rtrim($this->namespace, '\\') . '\\'; $namespace = rtrim($this->namespace, '\\') . '\\';
} }
@@ -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;
} }
} }
@@ -79,7 +79,7 @@ class ParamTag extends Tag
*/ */
public function getType() public function getType()
{ {
return $this->type; return $this->docblock->expandType($this->type);
} }
/** /**