mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
initialize variables before include, so that var tag usage is normal
This commit is contained in:
@@ -60,11 +60,13 @@ DOCBLOCK;
|
|||||||
|
|
||||||
public function testInterpretingASimpleDocBlock(): void
|
public function testInterpretingASimpleDocBlock(): void
|
||||||
{
|
{
|
||||||
/**
|
/** @var DocBlock $docblock */
|
||||||
* @var DocBlock $docblock
|
$docblock;
|
||||||
* @var string $summary
|
/** @var string $summary */
|
||||||
* @var Description $description
|
$summary;
|
||||||
*/
|
/** @var Description $description */
|
||||||
|
$description;
|
||||||
|
|
||||||
include(__DIR__ . '/../../examples/01-interpreting-a-simple-docblock.php');
|
include(__DIR__ . '/../../examples/01-interpreting-a-simple-docblock.php');
|
||||||
|
|
||||||
$descriptionText = <<<DESCRIPTION
|
$descriptionText = <<<DESCRIPTION
|
||||||
@@ -83,12 +85,15 @@ DESCRIPTION;
|
|||||||
|
|
||||||
public function testInterpretingTags(): void
|
public function testInterpretingTags(): void
|
||||||
{
|
{
|
||||||
/**
|
/** @var DocBlock $docblock */
|
||||||
* @var DocBlock $docblock
|
$docblock;
|
||||||
* @var boolean $hasSeeTag
|
/** @var boolean $hasSeeTag */
|
||||||
* @var Tag[] $tags
|
$hasSeeTag;
|
||||||
* @var See[] $seeTags
|
/** @var Tag[] $tags */
|
||||||
*/
|
$tags;
|
||||||
|
/** @var See[] $seeTags */
|
||||||
|
$seeTags;
|
||||||
|
|
||||||
include(__DIR__ . '/../../examples/02-interpreting-tags.php');
|
include(__DIR__ . '/../../examples/02-interpreting-tags.php');
|
||||||
|
|
||||||
$this->assertTrue($hasSeeTag);
|
$this->assertTrue($hasSeeTag);
|
||||||
@@ -105,15 +110,19 @@ DESCRIPTION;
|
|||||||
|
|
||||||
public function testDescriptionsCanEscapeAtSignsAndClosingBraces(): void
|
public function testDescriptionsCanEscapeAtSignsAndClosingBraces(): void
|
||||||
{
|
{
|
||||||
/**
|
/** @var string $docComment */
|
||||||
* @var string $docComment
|
$docComment;
|
||||||
* @var DocBlock $docblock
|
/** @var DocBlock $docblock */
|
||||||
* @var Description $description
|
$docblock;
|
||||||
* @var string $receivedDocComment
|
/** @var Description $description */
|
||||||
* @var string $foundDescription
|
$description;
|
||||||
*/
|
/** @var string $receivedDocComment */
|
||||||
|
$receivedDocComment;
|
||||||
|
/** @var string $foundDescription */
|
||||||
|
$foundDescription;
|
||||||
|
|
||||||
include(__DIR__ . '/../../examples/playing-with-descriptions/02-escaping.php');
|
include(__DIR__ . '/../../examples/playing-with-descriptions/02-escaping.php');
|
||||||
|
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
<<<'DESCRIPTION'
|
<<<'DESCRIPTION'
|
||||||
You can escape the @-sign by surrounding it with braces, for example: @. And escape a closing brace within an
|
You can escape the @-sign by surrounding it with braces, for example: @. And escape a closing brace within an
|
||||||
|
|||||||
@@ -31,10 +31,11 @@ class ReconstitutingADocBlockTest extends TestCase
|
|||||||
|
|
||||||
public function testReconstituteADocBlock(): void
|
public function testReconstituteADocBlock(): void
|
||||||
{
|
{
|
||||||
/**
|
/** @var string $docComment */
|
||||||
* @var string $docComment
|
$docComment;
|
||||||
* @var string $reconstitutedDocComment
|
/** @var string $reconstitutedDocComment */
|
||||||
*/
|
$reconstitutedDocComment;
|
||||||
|
|
||||||
include(__DIR__ . '/../../examples/03-reconstituting-a-docblock.php');
|
include(__DIR__ . '/../../examples/03-reconstituting-a-docblock.php');
|
||||||
|
|
||||||
$this->assertSame($docComment, $reconstitutedDocComment);
|
$this->assertSame($docComment, $reconstitutedDocComment);
|
||||||
|
|||||||
@@ -33,11 +33,13 @@ class UsingTagsTest extends TestCase
|
|||||||
|
|
||||||
public function testAddingYourOwnTagUsingAStaticMethodAsFactory(): void
|
public function testAddingYourOwnTagUsingAStaticMethodAsFactory(): void
|
||||||
{
|
{
|
||||||
/**
|
/** @var object[] $customTagObjects */
|
||||||
* @var object[] $customTagObjects
|
$customTagObjects;
|
||||||
* @var string $docComment
|
/** @var string $docComment */
|
||||||
* @var string $reconstitutedDocComment
|
$docComment;
|
||||||
*/
|
/** @var string $reconstitutedDocComment */
|
||||||
|
$reconstitutedDocComment;
|
||||||
|
|
||||||
include(__DIR__ . '/../../examples/04-adding-your-own-tag.php');
|
include(__DIR__ . '/../../examples/04-adding-your-own-tag.php');
|
||||||
|
|
||||||
$this->assertInstanceOf(\MyTag::class, $customTagObjects[0]);
|
$this->assertInstanceOf(\MyTag::class, $customTagObjects[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user