Skip to content

Commit

Permalink
bug #4911 PhpdocSeparationFixer - fix regression with lack of next li…
Browse files Browse the repository at this point in the history
…ne (keradus)

This PR was submitted for the 2.16 branch but it was squashed and merged into the 2.15 branch instead (closes #4911).

Discussion
----------

PhpdocSeparationFixer - fix regression with lack of next line

Commits
-------

323c594 PhpdocSeparationFixer - fix regression with lack of next line
  • Loading branch information
keradus committed Apr 10, 2020
2 parents c86164c + 323c594 commit 9640a31
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Fixer/Phpdoc/PhpdocSeparationFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private function fixDescription(DocBlock $doc)
if ($line->containsUsefulContent()) {
$next = $doc->getLine($index + 1);

if ($next->containsATag()) {
if (null !== $next && $next->containsATag()) {
$line->addBlank();

break;
Expand Down
12 changes: 12 additions & 0 deletions tests/Fixer/Phpdoc/PhpdocSeparationFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,18 @@ public function testLargerEmptyDocBlock()
*
*/
EOF;

$this->doTest($expected);
}

public function testOneLineDocBlock()
{
$expected = <<<'EOF'
<?php
/** Foo */
const Foo = 1;
EOF;

$this->doTest($expected);
Expand Down

0 comments on commit 9640a31

Please sign in to comment.