Skip to content

Commit

Permalink
Add sub namespace Groups fixture on AnnotationToAttributeRector
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 21, 2024
1 parent 69c2201 commit 96cb007
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

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

use Symfony\Component\Serializer\Attribute\Groups;

class Booking
{
/**
* @var int
*
* @Groups({"Booking.id"})
*/
private $id;

/**
* @var int
*
* @Source\Groups({"Booking.id"})
*/
private $id2;
}

?>
-----
<?php

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

use Symfony\Component\Serializer\Attribute\Groups;

class Booking
{
/**
* @var int
*/
#[Groups(['Booking.id'])]
private $id;

/**
* @var int
*
* @Source\Groups({"Booking.id"})
*/
private $id2;
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

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

class Groups
{
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
),
new AnnotationToAttribute('Sensio\Bundle\FrameworkExtraBundle\Configuration\Security'),

new AnnotationToAttribute('Symfony\Component\Serializer\Attribute\Groups'),

// special case with following comment becoming a inner value
new AnnotationToAttribute('When', When::class, useValueAsAttributeArgument: true),
new AnnotationToAttribute('Then', Then::class, useValueAsAttributeArgument: true),
Expand Down
15 changes: 15 additions & 0 deletions stubs/Symfony/Component/Serializer/Attribute/Groups.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

/** @changelog https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Routing/Annotation/Route.php */

declare(strict_types=1);

namespace Symfony\Component\Serializer\Attribute;

if (class_exists('Symfony\Component\Serializer\Attribute\Groups')) {
return;
}

class Groups
{
}

0 comments on commit 96cb007

Please sign in to comment.