Commit Graph

5 Commits

Author SHA1 Message Date
Maximilian Bösing
64e0a2d5ac
feat: allow psalm and phpstan prefix in docblocks
The following annotations are now properly handled: `@psalm-param`, 
`@phpstan-param`, `@psalm-return` and `@phpstan-return`.

If one of those found along with a basic `@param` or `@return` 
annotation, it will override the basic value.
2022-05-05 19:40:11 +02:00
Romain Canon
6d427088f7 feat!: improve object binding API
The method `MapperBuilder::bind()` can be used to define a custom way to
build an object during the mapping.

The return type of the callback will be resolved by the mapping to know
when to use it.

The callback can take any arguments, that will automatically be mapped
using the given source. These arguments can then be used to instantiate
the object in the desired way.

Example:

```php
(new \CuyZ\Valinor\MapperBuilder())
    ->bind(function(string $string, OtherClass $otherClass): SomeClass {
        $someClass = new SomeClass($string);
        $someClass->addOtherClass($otherClass);

        return $someClass;
    })
    ->mapper()
    ->map(SomeClass::class, [
        // …
    ]);
```
2022-02-19 19:58:28 +01:00
Romain Canon
b49ebf37be feat: introduce function definition repository 2022-02-19 19:58:28 +01:00
mtouellette
18ccbebb9a
fix: ensure native mixed types remain valid 2022-02-16 15:50:14 +01:00
Romain Canon
396f64a524 feat: initial release
🎉
2021-11-28 18:21:56 +01:00