Valinor/tests/Integration/Mapping/Object
Romain Canon 79d7c266ec feat: introduce automatic union of objects inferring during mapping
When the mapper needs to map a source to a union of objects, it will try
to guess which object it will map to, based on the needed arguments of
the objects, and the values contained in the source.

```php
final class UnionOfObjects
{
    public readonly SomeFooObject|SomeBarObject $object;
}

final class SomeFooObject
{
    public readonly string $foo;
}

final class SomeBarObject
{
    public readonly string $bar;
}

// Will map to an instance of `SomeFooObject`
(new \CuyZ\Valinor\MapperBuilder())
    ->mapper()
    ->map(UnionOfObjects::class, ['foo' => 'foo']);

// Will map to an instance of `SomeBarObject`
(new \CuyZ\Valinor\MapperBuilder())
    ->mapper()
    ->map(UnionOfObjects::class, ['bar' => 'bar']);
```
2022-01-07 13:41:15 +01:00
..
ArrayValuesMappingTest.php feat!: wrap node messages in proper class 2022-01-06 14:11:42 +01:00
DateTimeMappingTest.php misc!: allow object builder to yield arguments without source 2022-01-07 13:41:15 +01:00
EnumValuesMappingTest.php feat!: allow mapping to any type 2022-01-02 00:48:01 +01:00
GenericValuesMappingTest.php feat!: allow mapping to any type 2022-01-02 00:48:01 +01:00
IterableValuesMappingTest.php feat!: allow mapping to any type 2022-01-02 00:48:01 +01:00
ListValuesMappingTest.php feat!: wrap node messages in proper class 2022-01-06 14:11:42 +01:00
LocalTypeAliasMappingTest.php feat!: allow mapping to any type 2022-01-02 00:48:01 +01:00
ObjectValuesMappingTest.php misc!: allow object builder to yield arguments without source 2022-01-07 13:41:15 +01:00
ScalarValuesMappingTest.php feat!: wrap node messages in proper class 2022-01-06 14:11:42 +01:00
ShapedArrayValuesMappingTest.php feat!: wrap node messages in proper class 2022-01-06 14:11:42 +01:00
UnionOfObjectsMappingTest.php feat: introduce automatic union of objects inferring during mapping 2022-01-07 13:41:15 +01:00
UnionValuesMappingTest.php feat!: allow mapping to any type 2022-01-02 00:48:01 +01:00