CuyZ / Valinor

PHP library that helps to map any input into a strongly-typed value object structure.

Home Page:https://valinor.cuyz.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Anonymous classes not recognized

FernandoIberian opened this issue · comments

Since ~1.7.0 the following code does not work:

<?php

require 'vendor/autoload.php';

interface ValinorDTO {}

$stub = new class implements ValinorDTO {
    public string $foo;
}


return (new \CuyZ\Valinor\MapperBuilder())
    ->mapper()
    ->map(
        $stub::class,
        ['foo' => 'bar']
    );

Exception: CuyZ\Valinor\Type\Parser\Exception\UnknownSymbol: Cannot parse unknown symbol ValinorDTO@anonymous/absolute_path/file.php..

This is only used for testing purposes, i don't really know if parsing annonymous classes should be in the scope of this library, but if it is, i'm happy to help! Thank you :)

Should have been fixed by #504!