Valinor/tests
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
..
Fake misc!: allow object builder to yield arguments without source 2022-01-07 13:41:15 +01:00
Fixture fix: handle nested attributes compilation 2021-12-27 20:57:38 +01:00
Functional fix: handle nested attributes compilation 2021-12-27 20:57:38 +01:00
Integration feat: introduce automatic union of objects inferring during mapping 2022-01-07 13:41:15 +01:00
Traits feat: initial release 2021-11-28 18:21:56 +01:00
Unit misc!: allow object builder to yield arguments without source 2022-01-07 13:41:15 +01:00