Skip to content

Gedmo annotation are transformed and broken when applying a minimal set #3131

@Nuscly

Description

@Nuscly

Bug Report

Subject Details
Rector version rector/rector@sha256:c0c95f18e305a299448765e51d94027b4111b4a97476809c3e3644639933f9e1
Installed as with docker as it's a php 7.0 project processed: rector/rector:latest from this week

On this project, we are migrating Symfony version, but even with a minimal set, I can reproduce the bug, the rector [applying] Rector\Renaming\Rector\Class_\RenameClassRector is applied many time on the file, and is the only one.

rector.yml file:

parameters:
    sets:
        - 'twig112'
    php_version_features: '7.0'

Minimal PHP Code Causing Issue

I try to reproduce here https://getrector.org/demo/289ca160-fe8b-4cfd-bef4-463c5804761b#result but it fails due to missing extension.

Boggus transformation:

    ---------- begin diff ----------
--- Original
+++ New
@@ -249,7 +249,7 @@
     /**
      * @var string
      *
-     * @Gedmo\Slug(fields={"lastName", "firstName"}, prefix="papo-")
+     * @Gedmo\Slug(fields={"lastName", "firstName"})
      * @ORM\Column(type="string", length=128)
      */
     protected $gitoliteName;
@@ -315,7 +315,7 @@
     /**
      * @var User
      *
-     * @Gedmo\Blameable(on="create")
+     * @Gedmo\Blameable(create)
      * @ORM\ManyToOne(targetEntity="Akeneo\Bundle\UserBundle\Entity\User")
      * @ORM\JoinColumn(name="created_by", referencedColumnName="id", onDelete="CASCADE")
      * @Assert\Type("Akeneo\Bundle\UserBundle\Entity\User", groups={"scoring"})
@@ -325,7 +325,7 @@
     /**
      * @var User
      *
-     * @Gedmo\Blameable(on="update")
+     * @Gedmo\Blameable(update)
      * @ORM\ManyToOne(targetEntity="Akeneo\Bundle\UserBundle\Entity\User")
      * @ORM\JoinColumn(name="updated_by", referencedColumnName="id", nullable=true, onDelete="SET NULL")
      */
    ----------- end diff -----------

Expected Behaviour

All the Gedmo annotation properties should be kept, but some are removed or transformed without any reason.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions