|
18 | 18 | use PHPStan\Type\Constant\ConstantBooleanType; |
19 | 19 | use PHPStan\Type\Generic\TemplateMixedType; |
20 | 20 | use PHPStan\Type\Generic\TemplateType; |
21 | | -use PHPStan\Type\Traits\MaybeIterableTypeTrait; |
22 | | -use PHPStan\Type\Traits\MaybeOffsetAccessibleTypeTrait; |
23 | 21 | use PHPStan\Type\Traits\NonGenericTypeTrait; |
24 | 22 | use PHPStan\Type\Traits\UndecidedComparisonCompoundTypeTrait; |
25 | 23 |
|
26 | 24 | /** @api */ |
27 | 25 | class MixedType implements CompoundType, SubtractableType |
28 | 26 | { |
29 | 27 |
|
30 | | - use MaybeIterableTypeTrait; |
31 | | - use MaybeOffsetAccessibleTypeTrait; |
32 | 28 | use NonGenericTypeTrait; |
33 | 29 | use UndecidedComparisonCompoundTypeTrait; |
34 | 30 |
|
@@ -118,7 +114,7 @@ public function isSuperTypeOf(Type $type): TrinaryLogic |
118 | 114 |
|
119 | 115 | public function setOffsetValueType(?Type $offsetType, Type $valueType, bool $unionValues = true): Type |
120 | 116 | { |
121 | | - return new MixedType(); |
| 117 | + return new self($this->isExplicitMixed); |
122 | 118 | } |
123 | 119 |
|
124 | 120 | public function isCallable(): TrinaryLogic |
@@ -332,7 +328,44 @@ public function toString(): Type |
332 | 328 |
|
333 | 329 | public function toArray(): Type |
334 | 330 | { |
335 | | - return new ArrayType(new MixedType(), new MixedType()); |
| 331 | + $mixed = new self($this->isExplicitMixed); |
| 332 | + |
| 333 | + return new ArrayType($mixed, $mixed); |
| 334 | + } |
| 335 | + |
| 336 | + public function isIterable(): TrinaryLogic |
| 337 | + { |
| 338 | + return TrinaryLogic::createMaybe(); |
| 339 | + } |
| 340 | + |
| 341 | + public function isIterableAtLeastOnce(): TrinaryLogic |
| 342 | + { |
| 343 | + return TrinaryLogic::createMaybe(); |
| 344 | + } |
| 345 | + |
| 346 | + public function getIterableKeyType(): Type |
| 347 | + { |
| 348 | + return new self($this->isExplicitMixed); |
| 349 | + } |
| 350 | + |
| 351 | + public function getIterableValueType(): Type |
| 352 | + { |
| 353 | + return new self($this->isExplicitMixed); |
| 354 | + } |
| 355 | + |
| 356 | + public function isOffsetAccessible(): TrinaryLogic |
| 357 | + { |
| 358 | + return TrinaryLogic::createMaybe(); |
| 359 | + } |
| 360 | + |
| 361 | + public function hasOffsetValueType(Type $offsetType): TrinaryLogic |
| 362 | + { |
| 363 | + return TrinaryLogic::createMaybe(); |
| 364 | + } |
| 365 | + |
| 366 | + public function getOffsetValueType(Type $offsetType): Type |
| 367 | + { |
| 368 | + return new self($this->isExplicitMixed); |
336 | 369 | } |
337 | 370 |
|
338 | 371 | public function isExplicitMixed(): bool |
|
0 commit comments