Open
Description
With Doctrine, we can define an array of enum as a json array column using Types::JSON
with enumType
option.
/** @var Foobar[] $foobars */
#[ORM\Column(type: Types::JSON, enumType: Foobar::class, options: ['default' => '[]'])]
private array $foobars = [];
This result in the following phpstan error:
Property App\Entity\User::$foobars type mapping mismatch: backing type string of enum App\Enums\Foobar does not match value type mixed of the database type array|bool|float|int|JsonSerializable|stdClass|string|null.
🪪 doctrine.enumType
If I switch to Types::SIMPLE_ARRAY
, no error anymore.
I guess the rule does not handle json array yet.
Metadata
Metadata
Assignees
Labels
No labels