mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-17 17:47:13 +00:00
Add __toString() methods for Description and Tag
And let the Serializer make use of the (string) $tag
This commit is contained in:
@@ -209,14 +209,12 @@ class Description implements \Reflector
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the exported information (we should use the export static method
|
* Returns the long description as a string.
|
||||||
* BUT this throws an exception at this point).
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @codeCoverageIgnore Not yet implemented
|
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return 'Not yet implemented';
|
return $this->getContents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ class Serializer
|
|||||||
|
|
||||||
/** @var Tag $tag */
|
/** @var Tag $tag */
|
||||||
foreach ($docblock->getTags() as $tag) {
|
foreach ($docblock->getTags() as $tag) {
|
||||||
$tagText = "@{$tag->getName()} {$tag->getContent()}";
|
$tagText = (string) $tag;
|
||||||
if ($this->lineLength) {
|
if ($this->lineLength) {
|
||||||
$tagText = wordwrap($tagText, $wrapLength);
|
$tagText = wordwrap($tagText, $wrapLength);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,14 +366,12 @@ class Tag implements \Reflector
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the exported information (we should use the export static method
|
* Returns the tag as a serialized string
|
||||||
* BUT this throws an exception at this point).
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @codeCoverageIgnore Not yet implemented
|
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return 'Not yet implemented';
|
return "@{$this->getName()} {$this->getContent()}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user