EOF;
$serializer =
new Serializer([ new ObjectNormalizer(null, null, null,
new PhpDocExtractor()),
new ArrayDenormalizer(),
],
['json' =>
new JsonEncoder()]);
/** @var Zoo|ZooImmutable $zoo */
$zoo =
$serializer->
deserialize($json,
$class, 'json'
);
self::
assertCount(1,
$zoo->
getAnimals());
self::
assertInstanceOf(Animal::
class,
$zoo->
getAnimals()[0
]);
} public function testPropertyPhpDocWithKeyTypes() { $json = <<<EOF
{
"animalsInt": [
{"name": "Bug"}
],
"animalsString": {
"animal1": {"name": "Bug"}
},
"animalsUnion": {
"animal2": {"name": "Bug"},
"2": {"name": "Dog"}
},
"animalsGenerics": {
"animal3": {"name": "Bug"},
"3": {"name": "Dog"}
}
}