Inverted @param and @return hierarchy;

More fixes to tests and code coverage increase.
This commit is contained in:
Vasil Rangelov
2012-11-10 20:27:57 +02:00
parent ad32c225c5
commit 6e1bb192b3
12 changed files with 100 additions and 107 deletions
@@ -19,7 +19,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class MethodTag extends ParamTag
class MethodTag extends ReturnTag
{
/** @var string */
@@ -12,8 +12,6 @@
namespace phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @param tag in a Docblock.
*
@@ -21,11 +19,8 @@ use phpDocumentor\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class ParamTag extends Tag
class ParamTag extends ReturnTag
{
/** @var string */
protected $type = '';
/**
* @var string
*/
@@ -62,32 +57,6 @@ class ParamTag extends Tag
$this->description = implode(' ', $content);
}
/**
* Returns the unique types of the variable.
*
* @return string[]
*/
public function getTypes()
{
$types = new \phpDocumentor\Reflection\DocBlock\Type\Collection(
array($this->type),
$this->docblock ? $this->docblock->getNamespace() : null,
$this->docblock ? $this->docblock->getNamespaceAliases() : array()
);
return $types->getArrayCopy();
}
/**
* Returns the type section of the variable.
*
* @return string
*/
public function getType()
{
return implode('|', $this->getTypes());
}
/**
* Returns the variable's name.
*
@@ -12,6 +12,8 @@
namespace phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @return tag in a Docblock.
*
@@ -19,10 +21,10 @@ namespace phpDocumentor\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class ReturnTag extends ParamTag
class ReturnTag extends Tag
{
/** @var string */
protected $type = null;
protected $type = '';
/**
* Parses a tag and populates the member variables.
@@ -42,4 +44,30 @@ class ReturnTag extends ParamTag
$this->description = implode(' ', $content);
}
/**
* Returns the unique types of the variable.
*
* @return string[]
*/
public function getTypes()
{
$types = new \phpDocumentor\Reflection\DocBlock\Type\Collection(
array($this->type),
$this->docblock ? $this->docblock->getNamespace() : null,
$this->docblock ? $this->docblock->getNamespaceAliases() : array()
);
return $types->getArrayCopy();
}
/**
* Returns the type section of the variable.
*
* @return string
*/
public function getType()
{
return implode('|', $this->getTypes());
}
}