Closed dliebner closed 1 year ago
class ExampleDTO { public int $foo; protected string $bar; /** @var bool[] */ protected $baz; } $config = new Configuration('ExampleDTO'); $hydratorClass = $config->createFactory()->getHydratorClass(); $hydrator = new $hydratorClass(); $hydrator->hydrate( ['foo' => '150', 'bar' => 5, 'baz' => [1,0,0]], $object = new ExampleDTO() ); var_dump($object);
baz array isn't getting converted to bools. Is there a proper way to hint this that will enforce the casting of baz to bool[]?
baz
bool[]
Hydration is just hydration: conversion is up to you.
If you are looking for a mapper, see cuyz/valinor
cuyz/valinor
baz
array isn't getting converted to bools. Is there a proper way to hint this that will enforce the casting ofbaz
tobool[]
?