3 declare(strict_types=1);
5 namespace CuyZ\Valinor\Mapper\Object\Exception;
7 use CuyZ\Valinor\Definition\FunctionDefinition;
8 use CuyZ\Valinor\Type\Types\UnresolvableType;
12 final class InvalidConstructorReturnType extends LogicException
14 public function __construct(FunctionDefinition $function)
16 $returnType = $function->returnType();
18 if ($returnType instanceof UnresolvableType) {
19 $message = $returnType->message();
21 $message = "Invalid return type `{$returnType->toString()}` for constructor `{$function->signature()}`, it must be a valid class name.";
24 parent::__construct($message, 1659446121);