1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Type; |
4: | |
5: | use PHPStan\TrinaryLogic; |
6: | use PHPStan\Type\Traits\FalseyBooleanTypeTrait; |
7: | use PHPStan\Type\Traits\NonCallableTypeTrait; |
8: | use PHPStan\Type\Traits\NonGeneralizableTypeTrait; |
9: | use PHPStan\Type\Traits\NonGenericTypeTrait; |
10: | use PHPStan\Type\Traits\NonIterableTypeTrait; |
11: | use PHPStan\Type\Traits\NonObjectTypeTrait; |
12: | use PHPStan\Type\Traits\NonOffsetAccessibleTypeTrait; |
13: | use PHPStan\Type\Traits\NonRemoveableTypeTrait; |
14: | use PHPStan\Type\Traits\UndecidedComparisonTypeTrait; |
15: | |
16: | |
17: | class VoidType implements Type |
18: | { |
19: | |
20: | use NonCallableTypeTrait; |
21: | use NonIterableTypeTrait; |
22: | use NonObjectTypeTrait; |
23: | use NonOffsetAccessibleTypeTrait; |
24: | use FalseyBooleanTypeTrait; |
25: | use NonGenericTypeTrait; |
26: | use UndecidedComparisonTypeTrait; |
27: | use NonRemoveableTypeTrait; |
28: | use NonGeneralizableTypeTrait; |
29: | |
30: | |
31: | public function __construct() |
32: | { |
33: | } |
34: | |
35: | |
36: | |
37: | |
38: | public function getReferencedClasses(): array |
39: | { |
40: | return []; |
41: | } |
42: | |
43: | public function accepts(Type $type, bool $strictTypes): TrinaryLogic |
44: | { |
45: | if ($type instanceof CompoundType) { |
46: | return $type->isAcceptedBy($this, $strictTypes); |
47: | } |
48: | |
49: | return TrinaryLogic::createFromBoolean($type instanceof self); |
50: | } |
51: | |
52: | public function isSuperTypeOf(Type $type): TrinaryLogic |
53: | { |
54: | if ($type instanceof self) { |
55: | return TrinaryLogic::createYes(); |
56: | } |
57: | |
58: | if ($type instanceof CompoundType) { |
59: | return $type->isSubTypeOf($this); |
60: | } |
61: | |
62: | return TrinaryLogic::createNo(); |
63: | } |
64: | |
65: | public function equals(Type $type): bool |
66: | { |
67: | return $type instanceof self; |
68: | } |
69: | |
70: | public function describe(VerbosityLevel $level): string |
71: | { |
72: | return 'void'; |
73: | } |
74: | |
75: | public function toNumber(): Type |
76: | { |
77: | return new ErrorType(); |
78: | } |
79: | |
80: | public function toString(): Type |
81: | { |
82: | return new ErrorType(); |
83: | } |
84: | |
85: | public function toInteger(): Type |
86: | { |
87: | return new ErrorType(); |
88: | } |
89: | |
90: | public function toFloat(): Type |
91: | { |
92: | return new ErrorType(); |
93: | } |
94: | |
95: | public function toArray(): Type |
96: | { |
97: | return new ErrorType(); |
98: | } |
99: | |
100: | public function isArray(): TrinaryLogic |
101: | { |
102: | return TrinaryLogic::createNo(); |
103: | } |
104: | |
105: | public function isOversizedArray(): TrinaryLogic |
106: | { |
107: | return TrinaryLogic::createNo(); |
108: | } |
109: | |
110: | public function isString(): TrinaryLogic |
111: | { |
112: | return TrinaryLogic::createNo(); |
113: | } |
114: | |
115: | public function isNumericString(): TrinaryLogic |
116: | { |
117: | return TrinaryLogic::createNo(); |
118: | } |
119: | |
120: | public function isNonEmptyString(): TrinaryLogic |
121: | { |
122: | return TrinaryLogic::createNo(); |
123: | } |
124: | |
125: | public function isNonFalsyString(): TrinaryLogic |
126: | { |
127: | return TrinaryLogic::createNo(); |
128: | } |
129: | |
130: | public function isLiteralString(): TrinaryLogic |
131: | { |
132: | return TrinaryLogic::createNo(); |
133: | } |
134: | |
135: | public function traverse(callable $cb): Type |
136: | { |
137: | return $this; |
138: | } |
139: | |
140: | |
141: | |
142: | |
143: | public static function __set_state(array $properties): Type |
144: | { |
145: | return new self(); |
146: | } |
147: | |
148: | } |
149: | |