Write example on escaping values in a DocBlock

This commit is contained in:
Mike van Riel
2015-06-28 19:49:32 +02:00
parent 216cf0025f
commit ed4c6b77ab
4 changed files with 81 additions and 4 deletions
@@ -66,4 +66,32 @@ DESCRIPTION;
$this->assertSame('\\' . StandardTagFactory::class, (string)$seeTag->getReference());
$this->assertSame('', (string)$seeTag->getDescription());
}
public function testDescriptionsCanEscapeAtSignsAndClosingBraces()
{
/**
* @var string $docComment
* @var DocBlock $docblock
* @var Description $description
* @var string $receivedDocComment
* @var string $foundDescription
*/
include(__DIR__ . '/../../examples/playing-with-descriptions/02-escaping.php');
$this->assertSame(<<<'DESCRIPTION'
You can escape the @-sign by surrounding it with braces, for example: @. And escape a closing brace within an
inline tag by adding an opening brace in front of it like this: }.
Here are example texts where you can see how they could be used in a real life situation:
This is a text with an {@internal inline tag where a closing brace (}) is shown}.
Or an {@internal inline tag with a literal {@link} in it}.
Do note that an {@internal inline tag that has an opening brace ({) does not break out}.
DESCRIPTION
,
$foundDescription
)
;
}
}