Open
Description
Doctrine DBAL always converts the database value to a PHP array, even when the field contains null. SimpleArrayType mapper converts the null value from DB to an empty PHP array.
However, when I put a not-nullable type hint for the simple_array mapping from the nullable DB field:
/**
* @var list<string>
* @ORM\Column(type="simple_array", nullable=true)
*/
private $simpleArrayFromNullableField;
PHPStan check produces an error:
Property PHPStan\Rules\Doctrine\ORM\MyEntity::$simpleArrayFromNullableField type mapping mismatch: database can contain list<string>|null but property expects list<string>.
Metadata
Metadata
Assignees
Labels
No labels