Skip to content

Commit

Permalink
[Php80] Handle trailing comma on AnnotationToAttributeRector on Doctr…
Browse files Browse the repository at this point in the history
…ine JoinColumn (#2766)
  • Loading branch information
samsonasik authored Aug 15, 2022
1 parent 2977d09 commit 1f6cea3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ private function resolveAnnotationValues(BetterTokenIterator $tokenIterator): ar
if (is_array($nestedValues)) {
$values = array_merge($values, $nestedValues);
} else {
if ($tokenIterator->isCurrentTokenType(Lexer::TOKEN_END)) {
break;
}

$values[] = $nestedValues;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture\Doctrine;

use Doctrine\ORM\Mapping as ORM;

final class TrailingComma
{
/**
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", nullable=true, )
**/
protected $someColumn;
}

?>
-----
<?php

namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture\Doctrine;

use Doctrine\ORM\Mapping as ORM;

final class TrailingComma
{
#[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', nullable: true)]
protected $someColumn;
}

?>

0 comments on commit 1f6cea3

Please sign in to comment.