Moved the type separation into ReturnTag, for consistency with the type merging that is currently there.

This commit is contained in:
Vasil Rangelov
2012-11-16 21:43:25 +02:00
parent cdaa97eb31
commit db20ae39fb
3 changed files with 25 additions and 29 deletions
@@ -53,7 +53,7 @@ class ReturnTag extends Tag
public function getTypes()
{
$types = new \phpDocumentor\Reflection\DocBlock\Type\Collection(
array($this->type),
explode('|', $this->type),
$this->docblock ? $this->docblock->getNamespace() : null,
$this->docblock ? $this->docblock->getNamespaceAliases() : array()
);
@@ -22,9 +22,6 @@ namespace phpDocumentor\Reflection\DocBlock\Type;
*/
class Collection extends \ArrayObject
{
/** @var string Definition of the OR operator for types */
const OPERATOR_OR = '|';
/** @var string Definition of the ARRAY operator for types */
const OPERATOR_ARRAY = '[]';
@@ -167,14 +164,9 @@ class Collection extends \ArrayObject
.var_export($type, true)
);
}
// separate the type by the OR operator
$type_parts = explode(self::OPERATOR_OR, $type);
foreach ($type_parts as $part) {
$expanded_type = $this->expand($part);
if ($expanded_type) {
$this[] = $expanded_type;
}
$expanded_type = $this->expand($type);
if ($expanded_type) {
$this[] = $expanded_type;
}
}