Skip to content

Commit

Permalink
Merge fb948e8 into c8a9168
Browse files Browse the repository at this point in the history
  • Loading branch information
ashnazg committed Jan 7, 2018
2 parents c8a9168 + fb948e8 commit 47ebdab
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/DocBlockFactory.php
Expand Up @@ -166,7 +166,7 @@ private function splitDocBlock(string $comment)
[^\n.]+
(?:
(?! \. \n | \n{2} ) # End summary upon a dot followed by newline or two newlines
[\n.] (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line
[\n.]* (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line
[^\n.]+ # Include anything else
)*
\.?
Expand Down
25 changes: 25 additions & 0 deletions tests/integration/InterpretingDocBlocksTest.php
Expand Up @@ -33,6 +33,31 @@ public function tearDown(): void
m::close();
}

public function testInterpretingSummaryWithEllipsis(): void
{
$docblock = <<<DOCBLOCK
/**
* This is a short (...) description.
*
* This is a long description.
*
* @return void
*/
DOCBLOCK;

$factory = DocBlockFactory::createInstance();
$phpdoc = $factory->create($docblock);

$summary = 'This is a short (...) description.';
$description = 'This is a long description.';

$this->assertInstanceOf(DocBlock::class, $phpdoc);
$this->assertSame($summary, $phpdoc->getSummary());
$this->assertSame($description, $phpdoc->getDescription()->render());
$this->assertCount(1, $phpdoc->getTags());
$this->assertTrue($phpdoc->hasTag('return'));
}

public function testInterpretingASimpleDocBlock(): void
{
/**
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/DocBlockTest.php
Expand Up @@ -48,6 +48,21 @@ public function testDocBlockCanHaveASummary(): void
$this->assertSame($summary, $fixture->getSummary());
}

/**
* @covers ::__construct
* @covers ::getSummary
*
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testDocBlockCanHaveEllipsisInSummary(): void
{
$summary = 'This is a short (...) description.';

$fixture = new DocBlock($summary);

$this->assertSame($summary, $fixture->getSummary());
}

/**
* @covers ::__construct
* @covers ::getDescription
Expand Down

0 comments on commit 47ebdab

Please sign in to comment.