rector
rector copied to clipboard
Incorrect behavior of TypedPropertyFromColumnTypeRector
Bug Report
The default value of nullable on Column is false, so $bar and $baz below should both be converted the same way, but $bar is incorrectly set as nullable.
| Subject | Details |
|---|---|
| Rector version | 0.14.2 |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.org/demo/58adab3d-a4a3-4583-8bb8-90e36135991f
<?php
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class Foo
{
#[ORM\Column(type: 'string')]
private $bar;
#[ORM\Column(type: 'string', nullable: false)]
private $baz;
}
Responsible rules
TypedPropertyFromColumnTypeRector
Expected Behavior
$bar is string, not ?string
Except an #[ORM\Id] which can be auto, it will be nullable except assigned in constructor
I am closing it as except ID column, it is expected change without set initialization in constructor.