diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag.php b/src/phpDocumentor/Reflection/DocBlock/Tag.php index 4f0e26e..272132a 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Tag.php +++ b/src/phpDocumentor/Reflection/DocBlock/Tag.php @@ -159,7 +159,7 @@ class Tag implements \Reflector { $this->tag = $type; $this->content = $content; - $this->description = $content; + $this->description = trim($content); $this->docblock = $docblock; } diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php b/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php index a1ebc99..5819e55 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php +++ b/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Tag; /** @@ -32,13 +33,18 @@ class AuthorTag extends Tag /** * Parses a tag and populates the member variables. * - * @param string $type Tag identifier for this tag (should be 'author'). - * @param string $content The contents of the given tag. + * @param string $type Tag identifier for this tag (should be 'author'). + * @param string $content Contents for this tag. + * @param DocBlock $docblock The DocBlock which this tag belongs to. */ - public function __construct($type, $content) + public function __construct($type, $content, DocBlock $docblock = null) { - parent::__construct($type, $content); - if (preg_match('/^([^\<]*)(\<([^\>]*)\>)?$/', $content, $matches)) { + parent::__construct($type, $content, $docblock); + if (preg_match( + '/^([^\<]*)(\<([^\>]*)\>)?$/', + $this->description, + $matches + )) { $this->name = trim($matches[1]); if (isset($matches[3])) { $this->email = trim($matches[3]); diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag/LinkTag.php b/src/phpDocumentor/Reflection/DocBlock/Tag/LinkTag.php index 04d64fc..ce41ce4 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Tag/LinkTag.php +++ b/src/phpDocumentor/Reflection/DocBlock/Tag/LinkTag.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Tag; /** @@ -29,13 +30,14 @@ class LinkTag extends Tag /** * Parses a tag and populates the member variables. * - * @param string $type Tag identifier for this tag (should be 'link'). - * @param string $content The contents of the given tag. + * @param string $type Tag identifier for this tag (should be 'link'). + * @param string $content Contents for this tag. + * @param DocBlock $docblock The DocBlock which this tag belongs to. */ - public function __construct($type, $content) + public function __construct($type, $content, DocBlock $docblock = null) { - $this->tag = $type; - $pieces = explode(' ', $content); + parent::__construct($type, $content, $docblock); + $pieces = explode(' ', $this->description); if (count($pieces) > 1) { $this->link = array_shift($pieces); diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag/MethodTag.php b/src/phpDocumentor/Reflection/DocBlock/Tag/MethodTag.php index fba1070..e659977 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Tag/MethodTag.php +++ b/src/phpDocumentor/Reflection/DocBlock/Tag/MethodTag.php @@ -12,6 +12,9 @@ namespace phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tag; + /** * Reflection class for a @method in a Docblock. * @@ -31,13 +34,13 @@ class MethodTag extends ReturnTag /** * Parses a tag and populates the member variables. * - * @param string $type Tag identifier for this tag (should be 'method'). - * @param string $content The contents of the given tag. + * @param string $type Tag identifier for this tag (should be 'method'). + * @param string $content Contents for this tag. + * @param DocBlock $docblock The DocBlock which this tag belongs to. */ - public function __construct($type, $content) + public function __construct($type, $content, DocBlock $docblock = null) { - $this->tag = $type; - $this->content = $content; + Tag::__construct($type, $content, $docblock); $matches = array(); // 1. none or more whitespace @@ -51,7 +54,7 @@ class MethodTag extends ReturnTag if (preg_match( '/^[\s]*(?:([\w\|_\\\\]+)[\s]+)?(?:[\w_]+\(\)[\s]+)?([\w\|_\\\\]+)' .'\(([^\)]*)\)[\s]*(.*)/u', - $content, + $this->description, $matches )) { list( diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag/ParamTag.php b/src/phpDocumentor/Reflection/DocBlock/Tag/ParamTag.php index 12edd11..ec1ac5c 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Tag/ParamTag.php +++ b/src/phpDocumentor/Reflection/DocBlock/Tag/ParamTag.php @@ -12,6 +12,9 @@ namespace phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tag; + /** * Reflection class for a @param tag in a Docblock. * @@ -29,16 +32,16 @@ class ParamTag extends ReturnTag /** * Parses a tag and populates the member variables. * - * @param string $type Tag identifier for this tag (should be 'param'). - * @param string $content Contents for this tag. + * @param string $type Tag identifier for this tag (should be 'param'). + * @param string $content Contents for this tag. + * @param DocBlock $docblock The DocBlock which this tag belongs to. */ - public function __construct($type, $content) + public function __construct($type, $content, DocBlock $docblock = null) { - $this->tag = $type; - $this->content = $content; + Tag::__construct($type, $content, $docblock); $content = preg_split( '/(\s+)/u', - trim($content), + $this->description, 3, PREG_SPLIT_DELIM_CAPTURE ); diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag/ReturnTag.php b/src/phpDocumentor/Reflection/DocBlock/Tag/ReturnTag.php index da22677..df169fa 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Tag/ReturnTag.php +++ b/src/phpDocumentor/Reflection/DocBlock/Tag/ReturnTag.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Tag; /** @@ -29,15 +30,14 @@ class ReturnTag extends Tag /** * Parses a tag and populates the member variables. * - * @param string $type Tag identifier for this tag (should be 'return'). - * @param string $content Contents for this tag. + * @param string $type Tag identifier for this tag (should be 'return'). + * @param string $content Contents for this tag. + * @param DocBlock $docblock The DocBlock which this tag belongs to. */ - public function __construct($type, $content) + public function __construct($type, $content, DocBlock $docblock = null) { - $this->tag = $type; - $this->content = $content; - - $content = preg_split('/[\ \t]+/u', trim($content), 2); + parent::__construct($type, $content, $docblock); + $content = preg_split('/[\ \t]+/u', $this->description, 2); // any output is considered a type $this->type = array_shift($content); diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag/SeeTag.php b/src/phpDocumentor/Reflection/DocBlock/Tag/SeeTag.php index 6c89947..f73c3bb 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Tag/SeeTag.php +++ b/src/phpDocumentor/Reflection/DocBlock/Tag/SeeTag.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Tag; /** @@ -29,13 +30,13 @@ class SeeTag extends Tag /** * Parses a tag and populates the member variables. * - * @param string $type Tag identifier for this tag (should be 'see'). - * @param string $content Contents for this tag. + * @param string $type Tag identifier for this tag (should be 'see'). + * @param string $content Contents for this tag. + * @param DocBlock $docblock The DocBlock which this tag belongs to. */ - public function __construct($type, $content) + public function __construct($type, $content, DocBlock $docblock = null) { - $this->tag = $type; - $this->content = $content; + parent::__construct($type, $content, $docblock); $content = preg_split('/\s+/u', $content); // any output is considered a type diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag/VarTag.php b/src/phpDocumentor/Reflection/DocBlock/Tag/VarTag.php index f7e2493..d64cfa0 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Tag/VarTag.php +++ b/src/phpDocumentor/Reflection/DocBlock/Tag/VarTag.php @@ -12,6 +12,9 @@ namespace phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tag; + /** * Reflection class for a @var tag in a Docblock. * @@ -24,14 +27,14 @@ class VarTag extends ParamTag /** * Parses a tag and populates the member variables. * - * @param string $type Tag identifier for this tag (should be 'var'). - * @param string $content Contents for this tag. + * @param string $type Tag identifier for this tag (should be 'var'). + * @param string $content Contents for this tag. + * @param DocBlock $docblock The DocBlock which this tag belongs to. */ - public function __construct($type, $content) + public function __construct($type, $content, DocBlock $docblock = null) { - $this->tag = $type; - $this->content = $content; - $content = preg_split('/\s+/u', $content); + Tag::__construct($type, $content, $docblock); + $content = preg_split('/\s+/u', $this->description); if (count($content) == 0) { return;