cb2afe702b71fae0d42ab983f1bf8166d4df8fc3
[GitHub/WoltLab/WCF.git] /
1 <?php
2
3 declare(strict_types=1);
4
5 namespace CuyZ\Valinor\Type\Parser\Exception\Generic;
6
7 use CuyZ\Valinor\Type\Parser\Exception\InvalidType;
8 use CuyZ\Valinor\Type\Type;
9 use ReflectionClass;
10 use RuntimeException;
11
12 /** @internal */
13 final class InvalidExtendTagType extends RuntimeException implements InvalidType
14 {
15 /**
16 * @param ReflectionClass<object> $reflection
17 */
18 public function __construct(ReflectionClass $reflection, Type $invalidExtendTag)
19 {
20 /** @var ReflectionClass<object> $parentClass */
21 $parentClass = $reflection->getParentClass();
22
23 parent::__construct(
24 "The `@extends` tag of the class `$reflection->name` has invalid type `{$invalidExtendTag->toString()}`, it should be `{$parentClass->name}`.",
25 1670181134
26 );
27 }
28 }