rectorphp/rector-doctrine

DOCTRINE_CODE_QUALITY set-list is causing unnecessary qualifier

Closed this issue · 2 comments

I have a doctrine definition like so:

    /**
     * @var int
     */
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[ORM\Column(type: 'integer', name: 'some_id')]
    protected $id;

running the code quality set list is changing it to:

    /**
     * @var int
     */
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, name: 'some_id')]
    protected ?int $id = null;

I'd personally prefer Types::INTEGER to be written without a qualifier, using an import instead. But I can let my IDE handle that after rector is done, so not a huge deal. The problem is that after I change the qualifier to an import and run the set list again, the qualifier is re-introduced. I'd expect rector to leave fields alone, if they already make use of the constant.

What's your rector config? Did you set $rectorConfig->importNames();?

What's your rector config? Did you set $rectorConfig->importNames();?

thanks, that works. sorry for not reading the docs properly