FormHydrator::class => [
'__construct()' => [
'hydrator' => DynamicReference::to([
'class' => Hydrator::class,
'__construct()' => [
'typeCaster' => new CompositeTypeCaster(
new NullTypeCaster(emptyString: true),
new PhpNativeTypeCaster(),
new NonArrayTypeCaster(),
new \Yiisoft\Hydrator\TypeCaster\EnumTypeCaster(),
new HydratorTypeCaster(),
),
],
]),
],
],
It seems to me that this order will be good:
FormHydrator::class => [ '__construct()' => [ 'hydrator' => DynamicReference::to([ 'class' => Hydrator::class, '__construct()' => [ 'typeCaster' => new CompositeTypeCaster( new NullTypeCaster(emptyString: true), new PhpNativeTypeCaster(), new NonArrayTypeCaster(), new \Yiisoft\Hydrator\TypeCaster\EnumTypeCaster(), new HydratorTypeCaster(), ), ], ]), ], ],