Skip to content

Commit d9952bd

Browse files
committed
initialize variables before include, so that var tag usage is normal
1 parent ffc8cc1 commit d9952bd

File tree

3 files changed

+39
-27
lines changed

3 files changed

+39
-27
lines changed

tests/integration/InterpretingDocBlocksTest.php

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ public function testInterpretingSummaryWithEllipsis(): void
6060

6161
public function testInterpretingASimpleDocBlock(): void
6262
{
63-
/**
64-
* @var DocBlock $docblock
65-
* @var string $summary
66-
* @var Description $description
67-
*/
63+
/** @var DocBlock $docblock */
64+
$docblock;
65+
/** @var string $summary */
66+
$summary;
67+
/** @var Description $description */
68+
$description;
69+
6870
include(__DIR__ . '/../../examples/01-interpreting-a-simple-docblock.php');
6971

7072
$descriptionText = <<<DESCRIPTION
@@ -83,12 +85,15 @@ public function testInterpretingASimpleDocBlock(): void
8385

8486
public function testInterpretingTags(): void
8587
{
86-
/**
87-
* @var DocBlock $docblock
88-
* @var boolean $hasSeeTag
89-
* @var Tag[] $tags
90-
* @var See[] $seeTags
91-
*/
88+
/** @var DocBlock $docblock */
89+
$docblock;
90+
/** @var boolean $hasSeeTag */
91+
$hasSeeTag;
92+
/** @var Tag[] $tags */
93+
$tags;
94+
/** @var See[] $seeTags */
95+
$seeTags;
96+
9297
include(__DIR__ . '/../../examples/02-interpreting-tags.php');
9398

9499
$this->assertTrue($hasSeeTag);
@@ -105,15 +110,19 @@ public function testInterpretingTags(): void
105110

106111
public function testDescriptionsCanEscapeAtSignsAndClosingBraces(): void
107112
{
108-
/**
109-
* @var string $docComment
110-
* @var DocBlock $docblock
111-
* @var Description $description
112-
* @var string $receivedDocComment
113-
* @var string $foundDescription
114-
*/
113+
/** @var string $docComment */
114+
$docComment;
115+
/** @var DocBlock $docblock */
116+
$docblock;
117+
/** @var Description $description */
118+
$description;
119+
/** @var string $receivedDocComment */
120+
$receivedDocComment;
121+
/** @var string $foundDescription */
122+
$foundDescription;
115123

116124
include(__DIR__ . '/../../examples/playing-with-descriptions/02-escaping.php');
125+
117126
$this->assertSame(
118127
<<<'DESCRIPTION'
119128
You can escape the @-sign by surrounding it with braces, for example: @. And escape a closing brace within an

tests/integration/ReconstitutingADocBlockTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ public function tearDown(): void
3131

3232
public function testReconstituteADocBlock(): void
3333
{
34-
/**
35-
* @var string $docComment
36-
* @var string $reconstitutedDocComment
37-
*/
34+
/** @var string $docComment */
35+
$docComment;
36+
/** @var string $reconstitutedDocComment */
37+
$reconstitutedDocComment;
38+
3839
include(__DIR__ . '/../../examples/03-reconstituting-a-docblock.php');
3940

4041
$this->assertSame($docComment, $reconstitutedDocComment);

tests/integration/UsingTagsTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ public function tearDown(): void
3333

3434
public function testAddingYourOwnTagUsingAStaticMethodAsFactory(): void
3535
{
36-
/**
37-
* @var object[] $customTagObjects
38-
* @var string $docComment
39-
* @var string $reconstitutedDocComment
40-
*/
36+
/** @var object[] $customTagObjects */
37+
$customTagObjects;
38+
/** @var string $docComment */
39+
$docComment;
40+
/** @var string $reconstitutedDocComment */
41+
$reconstitutedDocComment;
42+
4143
include(__DIR__ . '/../../examples/04-adding-your-own-tag.php');
4244

4345
$this->assertInstanceOf(\MyTag::class, $customTagObjects[0]);

0 commit comments

Comments
 (0)