1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Type;
4:
5: use PHPStan\Turbo\ReferencedByTurboExtension;
6:
7: /** @api */
8: #[ReferencedByTurboExtension(key: 'errorType')]
9: class ErrorType extends MixedType
10: {
11:
12: /** @api */
13: public function __construct(private ?string $reason = null)
14: {
15: parent::__construct();
16: }
17:
18: public function getReason(): ?string
19: {
20: return $this->reason;
21: }
22:
23: public function describe(VerbosityLevel $level): string
24: {
25: return $level->handle(
26: fn (): string => parent::describe($level),
27: fn (): string => parent::describe($level),
28: static fn (): string => '*ERROR*',
29: );
30: }
31:
32: public function getIterableKeyType(): Type
33: {
34: return new ErrorType();
35: }
36:
37: public function getIterableValueType(): Type
38: {
39: return new ErrorType();
40: }
41:
42: public function subtract(Type $type): Type
43: {
44: return new self();
45: }
46:
47: public function equals(Type $type): bool
48: {
49: return $type instanceof self;
50: }
51:
52: }
53: