diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index dc90bf4..eda7c53 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -54,7 +54,7 @@ final class StandardTagFactory implements TagFactory 'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead', 'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property', 'property-write' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite', - 'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return', + 'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_', 'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See', 'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since', 'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source', diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index f3d461d..0247da0 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -17,9 +17,11 @@ use phpDocumentor\Reflection\DocBlock\Tags\Author; use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; use phpDocumentor\Reflection\DocBlock\Tags\Generic; +use phpDocumentor\Reflection\DocBlock\Tags\Return_; use phpDocumentor\Reflection\DocBlock\Tags\See; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; /** @@ -322,4 +324,38 @@ class StandardTagFactoryTest extends \PHPUnit_Framework_TestCase $tagFactory->registerTagHandler('my-tag', 'stdClass'); } + + /** + * @covers ::create + * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * @uses phpDocumentor\Reflection\Docblock\Description + * @uses phpDocumentor\Reflection\Docblock\Tags\Return_ + * @uses phpDocumentor\Reflection\Docblock\Tags\BaseTag + */ + public function testReturntagIsMappedCorrectly() + { + $context = new Context(''); + + $descriptionFactory = m::mock(DescriptionFactory::class); + $descriptionFactory + ->shouldReceive('create') + ->once() + ->with('', $context) + ->andReturn(new Description('')) + ; + + $typeResolver = new TypeResolver(); + + $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); + $tagFactory->addService($descriptionFactory, DescriptionFactory::class); + $tagFactory->addService($typeResolver, TypeResolver::class); + + + /** @var Return_ $tag */ + $tag = $tagFactory->create('@return mixed', $context); + + $this->assertInstanceOf(Return_::class, $tag); + $this->assertSame('return', $tag->getName()); + } }