JFIF x x C C " } !1AQa "q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w !1AQ aq"2B #3Rbr{
File "UndefinedObjectNodeBuilder.php"
Full Path: /home/palsarh/web/palsarh.in/public_html/vendor/cuyz/valinor/src/Mapper/Tree/Builder/UndefinedObjectNodeBuilder.php
File size: 826 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
declare(strict_types=1);
namespace CuyZ\Valinor\Mapper\Tree\Builder;
use CuyZ\Valinor\Mapper\Tree\Exception\CannotMapToPermissiveType;
use CuyZ\Valinor\Mapper\Tree\Exception\InvalidNodeValue;
use CuyZ\Valinor\Mapper\Tree\Shell;
use CuyZ\Valinor\Type\Types\UndefinedObjectType;
use function assert;
use function is_object;
/** @internal */
final class UndefinedObjectNodeBuilder implements NodeBuilder
{
public function build(Shell $shell): Node
{
assert($shell->type instanceof UndefinedObjectType);
if (! $shell->allowPermissiveTypes) {
throw new CannotMapToPermissiveType($shell);
}
$value = $shell->value();
if (! is_object($value)) {
return $shell->error(new InvalidNodeValue());
}
return $shell->node($value);
}
}