From 53d5adb3246eae5ee5e01b6e37ac891bedb0bb20 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 13 Jun 2015 20:27:27 +0200 Subject: [PATCH] Descriptions were not separated into tags --- src/DocBlock/DescriptionFactory.php | 2 +- src/DocBlock/TagFactory.php | 3 ++- src/DocBlockFactory.php | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 35fec55..5fa60ee 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -100,8 +100,8 @@ class DescriptionFactory $tagCount = 0; $tags = []; for ($i = 1; $i < $count; $i += 2) { - $tokens[$i] = '%' . ++$tagCount . '$s'; $tags[] = $this->tagFactory->create($tokens[$i], $context); + $tokens[$i] = '%' . ++$tagCount . '$s'; } //In order to allow "literal" inline tags, the otherwise invalid diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index 64563fa..2d83b26 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tags\Other; use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context; @@ -84,7 +85,7 @@ final class TagFactory } list($tagName, $tagBody) = $this->extractTagParts($tagLine); - $handler = Tag::class; + $handler = Other::class; if (isset($this->tagHandlerMappings[$tagName])) { $handler = $this->tagHandlerMappings[$tagName]; } elseif ($this->isAnnotation($tagName)) { diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index e5d5cb7..d1ca3d1 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\TagFactory; +use phpDocumentor\Reflection\Types\Context; final class DocBlockFactory implements DocBlockFactoryInterface { @@ -80,12 +81,16 @@ final class DocBlockFactory implements DocBlockFactoryInterface $docblock = $docblock->getDocComment(); } + if ($context === null) { + $context = new Context(''); + } + $parts = $this->splitDocBlock($this->stripDocComment($docblock)); list($templateMarker, $summary, $description, $tags) = $parts; return new DocBlock( $summary, - new DocBlock\Description($description), + $this->descriptionFactory->create($description, $context), $this->parseTagBlock($tags), $context, $location,