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->getMessage();
20 $previous = $returnType;
22 $message = "Invalid return type `{$returnType->toString()}` for constructor `{$function->signature()}`, it must be a valid class name.";
26 parent::__construct($message, 1659446121, $previous);