Skip to content

Commit

Permalink
[Php80] Test for misplaced , on multiline in AnnotationToAttributeRec…
Browse files Browse the repository at this point in the history
…tor (#219)

* Add failing test fixture for AnnotationToAttributeRector

# Failing Test for AnnotationToAttributeRector

Based on https://getrector.org/demo/ed127b6d-1e04-4f6d-9f10-be3b1a7a2068

* Closes #166

* fixture update

Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
  • Loading branch information
samsonasik and OskarStark committed Jun 14, 2021
1 parent fc17cc9 commit fb8842d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

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

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity()
*/
class Multiline2
{
/**
* @var Collection<int, Foo>
*
* @ORM\OrderBy({
* "createdAt": "DESC",
* })
*
* @ORM\OneToMany(targetEntity=Foo::class, mappedBy="user", orphanRemoval=true)
*/
private Collection $foos;
}

?>
-----
<?php

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

use Doctrine\ORM\Mapping as ORM;

#[\Doctrine\ORM\Mapping\Entity]
class Multiline2
{
/**
* @var Collection<int, Foo>
*
*
*/
#[\Doctrine\ORM\Mapping\OrderBy(['createdAt' => 'DESC'])]
#[\Doctrine\ORM\Mapping\OneToMany(targetEntity: Foo::class, mappedBy: 'user', orphanRemoval: true)]
private Collection $foos;
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
new AnnotationToAttribute('Doctrine\ORM\Mapping\Table'),
new AnnotationToAttribute('Doctrine\ORM\Mapping\Id'),
new AnnotationToAttribute('Doctrine\ORM\Mapping\Column'),
new AnnotationToAttribute('Doctrine\ORM\Mapping\OrderBy'),
new AnnotationToAttribute('Doctrine\ORM\Mapping\OneToMany'),
new AnnotationToAttribute('ApiPlatform\Core\Annotation\ApiResource'),
]),
]]);
Expand Down

0 comments on commit fb8842d

Please sign in to comment.