136b66e29d2c470ff1b288992c851fe73a9e2dac
[GitHub/WoltLab/WCF.git] /
1 <?php
2
3 declare(strict_types=1);
4
5 namespace CuyZ\Valinor\Mapper\Object\Exception;
6
7 use CuyZ\Valinor\Definition\FunctionDefinition;
8 use CuyZ\Valinor\Type\Types\UnresolvableType;
9 use LogicException;
10
11 /** @internal */
12 final class InvalidConstructorReturnType extends LogicException
13 {
14 public function __construct(FunctionDefinition $function)
15 {
16 $returnType = $function->returnType();
17
18 if ($returnType instanceof UnresolvableType) {
19 $message = $returnType->message();
20 } else {
21 $message = "Invalid return type `{$returnType->toString()}` for constructor `{$function->signature()}`, it must be a valid class name.";
22 }
23
24 parent::__construct($message, 1659446121);
25 }
26 }