Serde icon indicating copy to clipboard operation
Serde copied to clipboard

Enum and StaticTypeMap breaks

Open geek-merlin opened this issue 1 week ago • 2 comments

Got exception:

Error: Cannot instantiate enum FooAccountEnum in ReflectionClass->newInstanceWithoutConstructor() (line 168 of vendor/crell/serde/src/PropertyHandler/ObjectImporter.php).

from sth like this:

  public function __construct(
    #[StaticTypeMap(key: 'type', map: [
      'foo' => FooAccountEnum::class,
      'bar' => BarAccountEnum::class,
    ])]
    public readonly AccountInterface $account,
  ) {}

geek-merlin avatar Dec 18 '25 21:12 geek-merlin