Skip to content

Commit 3bf31c9

Browse files
authored
Merge pull request #144 from ashnazg/bug-63
Ellipsis in summary
2 parents c8a9168 + 7bd0e7e commit 3bf31c9

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

src/DocBlockFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private function splitDocBlock(string $comment)
166166
[^\n.]+
167167
(?:
168168
(?! \. \n | \n{2} ) # End summary upon a dot followed by newline or two newlines
169-
[\n.] (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line
169+
[\n.]* (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line
170170
[^\n.]+ # Include anything else
171171
)*
172172
\.?

tests/integration/InterpretingDocBlocksTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,31 @@ public function tearDown(): void
3333
m::close();
3434
}
3535

36+
public function testInterpretingSummaryWithEllipsis(): void
37+
{
38+
$docblock = <<<DOCBLOCK
39+
/**
40+
* This is a short (...) description.
41+
*
42+
* This is a long description.
43+
*
44+
* @return void
45+
*/
46+
DOCBLOCK;
47+
48+
$factory = DocBlockFactory::createInstance();
49+
$phpdoc = $factory->create($docblock);
50+
51+
$summary = 'This is a short (...) description.';
52+
$description = 'This is a long description.';
53+
54+
$this->assertInstanceOf(DocBlock::class, $phpdoc);
55+
$this->assertSame($summary, $phpdoc->getSummary());
56+
$this->assertSame($description, $phpdoc->getDescription()->render());
57+
$this->assertCount(1, $phpdoc->getTags());
58+
$this->assertTrue($phpdoc->hasTag('return'));
59+
}
60+
3661
public function testInterpretingASimpleDocBlock(): void
3762
{
3863
/**

tests/unit/DocBlockTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@ public function testDocBlockCanHaveASummary(): void
4848
$this->assertSame($summary, $fixture->getSummary());
4949
}
5050

51+
/**
52+
* @covers ::__construct
53+
* @covers ::getSummary
54+
*
55+
* @uses \phpDocumentor\Reflection\DocBlock\Description
56+
*/
57+
public function testDocBlockCanHaveEllipsisInSummary(): void
58+
{
59+
$summary = 'This is a short (...) description.';
60+
61+
$fixture = new DocBlock($summary);
62+
63+
$this->assertSame($summary, $fixture->getSummary());
64+
}
65+
5166
/**
5267
* @covers ::__construct
5368
* @covers ::getDescription

0 commit comments

Comments
 (0)