mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Merge pull request #60 from jaapio/fix/returntag
fix type mapping for return tag
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user