Skip to content

[Death-Code] RemoveUnusedPrivatePropertyRector remove Doctrine attributes #1922

@dirk39

Description

@dirk39
Subject Details
PHP version 7.3.7
Full Command vendor/bin/rector process /src

Current Behaviour

When I run reactor with `RemoveUnusedPrivatePropertyRector' property enabled it removes unused private properties on Doctrine entity, but these "unused" properties are annotated as Doctrine columns

Minimal PHP Code Causing Issue

rector.yaml:

services:
   Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector: ~ 

parameters:
    php_version_features: '7.3'

entity:

/*
 * @ORM\Entity()
 * @ORM\Table(name="reports")
 */
class ReportsCreate implements DomainEntityInterface
{
    /**
     * @Groups({"write", "item.read", "list.read"})
     *
     * @ORM\Id
     * @ORM\Column(type="uuid", unique=true)
     *
     * @var UuidInterface $id
     */
    private $id;

    /**
     * @Groups({"write", "item.read", "list.read"})
     * @ORM\Column(type="string", nullable=false, name="name")
     */
    private $name;

    /**
     * @Groups({"write", "item.read", "list.read"})
     * @ORM\Column(type="text", nullable=false, name="query")
     */
    private $query;

    /**
     * ReportsCreate constructor.
     */
    public function __construct()
    {
        $this->id = Uuid::uuid4();
    }
}

Expected Behaviour

I'm expecting that private attributes with Doctrine annotations have to be excluded by deletion

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions