github CuyZ/Valinor 2.2.0

6 hours ago

Notable new features

Mapping error messages improvements

Feedback has been improved in mapping error messages, especially the expected signature of the failing nodes.

This gets rid of the infamous ? that was used whenever an object was present in a type, leading to incomplete and misleading messages.

Example of a new message:

final class User
{
    public function __construct(
        public string $name,
        public int $age,
    ) {}
}

(new MapperBuilder())
    ->mapper()
    ->map(User::class, 'invalid value');

// Could not map type `User`. An error occurred at path *root*: Value
// 'invalid value' does not match `array{name: string, age: int}`.

Features

  • Improve mapping error messages types signatures (ce1b0a)

Bug Fixes

  • Prevent undefined values in non-empty-list (9739cd)
  • Properly detect nested invalid types during mapping (ad756a)
  • Use proper error message for invalid nullable scalar value (b84cbe)

Other

  • Add safeguard in type parsing when reading next type (da0de0)
  • Improve type parsing error when an unexpected token is found (5ae904)
  • Lighten types initialization (6f0b3f)
  • Parse iterable type the same way it is done with array (6291a7)
  • Rework how type traversing is used (20f17f)
  • Set default exception error code to unknown (c8ef49)

Don't miss a new Valinor release

NewReleases is sending notifications on new releases.