phpDocumentor/ReflectionDocBlock
Auf GitHub ansehenInline tag handling with nested braces is not working as expected
Open
#255 geöffnet am 20. Sept. 2020
bughelp wanted
Repository-Metriken
- Stars
- (9.386 Stars)
- PR-Merge-Metriken
- (Keine gemergten PRs in 30 T)
Beschreibung
Given the following test case, our Description doesn't work as expected with nested braces in inline tags.
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::__construct
* @covers ::create
*/
public function testDescriptionCanParseStringWithInlineTagAndBraces() : void
{
$contents = 'This description has a {@link http://phpdoc.org/ This contains {braces} }';
$context = new Context('');
$tagFactory = m::mock(TagFactory::class);
$tagFactory->shouldReceive('create')
->twice()
->andReturnValues(
[
new LinkTag('http://phpdoc.org/', new Description('This contains {braces}')),
]
);
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, $context);
$this->assertSame($contents, $description->render());
$this->assertSame('This description has a %1$s', $description->getBodyTemplate());
}