Commit Graph

11 Commits

Author SHA1 Message Date
Romain Canon
6fdd62dfc2 fix: change license in composer.json 2022-02-21 17:05:28 +01:00
Romain Canon
c1a884fadd qa: require and include phpstan/phpstan-phpunit rules 2022-02-19 19:58:28 +01:00
Marco Pivetta
822865876d chore: downgrade dependencies to a dependency set that works on 7.4 too
Used for locked tests.
2022-01-13 19:55:20 +01:00
Romain Canon
1e0084c6cd test: upgrade Infection to 0.26
This new version grants a new `--git-diff-lines` options, as well as a
new badge/report system.
2022-01-11 19:19:51 +01:00
Romain Canon
b2e810e3ce feat!: allow mapping to any type
Previously, the method `TreeMapper::map` would allow mapping only to an
object. It is now possible to map to any type handled by the library.

It is for instance possible to map to an array of objects:

```php
$objects = (new \CuyZ\Valinor\MapperBuilder())->mapper()->map(
    'array<' . SomeClass::class . '>',
    [/* … */]
);
```

For simple use-cases, an array shape can be used:

```php
$array = (new \CuyZ\Valinor\MapperBuilder())->mapper()->map(
    'array{foo: string, bar: int}',
    [/* … */]
);

echo strtolower($array['foo']);
echo $array['bar'] * 2;
```

This new feature changes the possible behaviour of the mapper, meaning
static analysis tools need help to understand the types correctly. An
extension for PHPStan and a plugin for Psalm are now provided and can be
included in a project to automatically increase the type coverage.
2022-01-02 00:48:01 +01:00
Romain Canon
0144bf084a misc: raise PHPStan version
This enables full PHP 8.1 support 🎉
2021-12-31 13:30:14 +01:00
Romain Canon
e5ccbe201b misc: raise version of friendsofphp/php-cs-fixer
Grants PHP 8.1 support.
2021-12-15 13:19:24 +01:00
Romain Canon
0b507c9b33 misc: change Composer scripts calls 2021-12-15 13:19:24 +01:00
Romain Canon
ce3dfb0ced misc: use marcocesarato/php-conventional-changelog for changelog 2021-12-07 18:59:46 +01:00
Romain Canon
1f754a7e77 misc: use composer runtime API 2021-11-29 12:36:00 +01:00
Romain Canon
396f64a524 feat: initial release
🎉
2021-11-28 18:21:56 +01:00