rectorphp/rector-doctrine

Faulty type-hinting and nullable state

Closed this issue · 1 comments

The set-list DOCTRINE_CODE_QUALITY changes this:

    #[ORM\Column(type: 'decimal', precision: 9, scale: 2)]
    protected $amount;

into this:

    #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DECIMAL, precision: 9, scale: 2)]
    protected ?string $amount = null;

The field nullable on ORM\Column is false by default. But the set-list seems to imply it to be true, adding an undesired ? and initializing the field with null.

sorry, just saw that this is a duplicate of #191