Commit Graph

8 Commits

Author SHA1 Message Date
Romain Canon
bf2264b8e3 doc: improve documentation building process 2022-06-22 11:15:26 +02:00
Romain Canon
1b0ff39af6 feat!: handle exhaustive list of interface inferring
It is now mandatory to list all possible class-types that can be
inferred by the mapper. This change is a step towards the library being
able to deliver powerful new features such as compiling a mapper for
better performance.

BREAKING CHANGE: the existing calls to `MapperBuilder::infer` that could
return several class-names must now add a signature to the callback. The
callbacks that require no parameter and always return the same
class-name can remain unchanged.

For instance:

```php
$builder = (new \CuyZ\Valinor\MapperBuilder())
    // Can remain unchanged
    ->infer(SomeInterface::class, fn () => SomeImplementation::class);
```

```php
$builder = (new \CuyZ\Valinor\MapperBuilder())
    ->infer(
        SomeInterface::class,
        fn (string $type) => match($type) {
            'first' => ImplementationA::class,
            'second' => ImplementationB::class,
            default => throw new DomainException("Unhandled `$type`.")
        }
    )
    // …should be modified with:
    ->infer(
        SomeInterface::class,
        /** @return class-string<ImplementationA|ImplementationB> */
        fn (string $type) => match($type) {
            'first' => ImplementationA::class,
            'second' => ImplementationB::class,
            default => throw new DomainException("Unhandled `$type`.")
        }
    );
```
2022-06-17 18:03:27 +02:00
Romain Canon
8920725b93 doc: add Open Graph meta tags 2022-06-12 16:37:58 +02:00
Romain Canon
d9ac693827 doc: remove badges from documentation index 2022-06-11 12:48:35 +02:00
Romain Canon
36f44c37a3 doc: change some settings and adjust logos 2022-06-10 23:33:28 +02:00
Romain Canon
afda9480f4 doc: fix https links 2022-06-10 19:17:05 +02:00
Romain Canon
aa27ceeb4a release: version 0.10.0 2022-06-10 19:00:31 +02:00
Nathan Boiron
56ff6849bc
doc: introduce mkdocs as a static documentation generator 2022-06-10 17:32:07 +02:00