Skip to content

Commit 6d705c1

Browse files
committed
Merge pull request #22 from barryvdh/tostring
Add __toString() methods for Description and Tag
2 parents ac6e37a + ab0bcb8 commit 6d705c1

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/phpDocumentor/Reflection/DocBlock/Description.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,12 @@ public static function export()
209209
}
210210

211211
/**
212-
* Returns the exported information (we should use the export static method
213-
* BUT this throws an exception at this point).
212+
* Returns the long description as a string.
214213
*
215214
* @return string
216-
* @codeCoverageIgnore Not yet implemented
217215
*/
218216
public function __toString()
219217
{
220-
return 'Not yet implemented';
218+
return $this->getContents();
221219
}
222220
}

src/phpDocumentor/Reflection/DocBlock/Serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function getDocComment(DocBlock $docblock)
182182

183183
/** @var Tag $tag */
184184
foreach ($docblock->getTags() as $tag) {
185-
$tagText = "@{$tag->getName()} {$tag->getContent()}";
185+
$tagText = (string) $tag;
186186
if ($this->lineLength) {
187187
$tagText = wordwrap($tagText, $wrapLength);
188188
}

src/phpDocumentor/Reflection/DocBlock/Tag.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,12 @@ public static function export()
366366
}
367367

368368
/**
369-
* Returns the exported information (we should use the export static method
370-
* BUT this throws an exception at this point).
369+
* Returns the tag as a serialized string
371370
*
372371
* @return string
373-
* @codeCoverageIgnore Not yet implemented
374372
*/
375373
public function __toString()
376374
{
377-
return 'Not yet implemented';
375+
return "@{$this->getName()} {$this->getContent()}";
378376
}
379377
}

0 commit comments

Comments
 (0)