packagist cuyz/valinor 2.8.0

2 hours ago

Notable changes

PHP 8.6 support 🐘

PHP 8.6 is released today, and the library supports it from day one!

Since this version, a readonly property can be declared with a default value: it is initialized when the object is instantiated and cannot be written again. Such a property is not part of the mapped values: it keeps its default value, and a value given for it in the source is reported as an unexpected key.

final class Article
{
    public readonly string $status = 'draft';

    public string $title;
}

$article = (new \CuyZ\Valinor\MapperBuilder())
    ->mapper()
    ->map(Article::class, ['title' => 'Hello world']);

$article->status; // 'draft'

Features

  • Add support for PHP 8.6 (c6694f)

Bug Fixes

  • Allow default value on argument filled by a fixed generic (dcd615)
  • Do not map readonly properties with default value (38fe41)
  • Keep keys of non-list array normalized as shaped list (13d882)
  • Return actual native types from types (0185fd)

Don't miss a new valinor release

NewReleases is sending notifications on new releases.