Skip to content

Support for checking type of a value in a oneof/anyof type group

Choose a tag to compare

@asadali214 asadali214 released this 13 Jun 10:08
· 24 commits to master since this release
99fc537

This release brings the following improvement in oneof/anyof features:

Now JsonMapper also support checking for a type of any given value in the provided type group, with jsonMapper's method checkTypeGroupFor. Following code sample demonstrate how one can check the type of any value.

$mapper = new JsonMapper();
$value = new Car();
$value = $mapper->checkTypeGroupFor('oneof(Car,Atom)', $value);

Here checkTypeGroupFor will throw a JsonMapperException if value's type didn't exist in the provided type group.