1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Type\Generic; |
4: | |
5: | use PHPStan\Type\AcceptsResult; |
6: | use PHPStan\Type\IsSuperTypeOfResult; |
7: | use PHPStan\Type\MixedType; |
8: | use PHPStan\Type\StrictMixedType; |
9: | use PHPStan\Type\Type; |
10: | |
11: | |
12: | final class TemplateStrictMixedType extends StrictMixedType implements TemplateType |
13: | { |
14: | |
15: | |
16: | use TemplateTypeTrait; |
17: | |
18: | |
19: | |
20: | |
21: | public function __construct( |
22: | TemplateTypeScope $scope, |
23: | TemplateTypeStrategy $templateTypeStrategy, |
24: | TemplateTypeVariance $templateTypeVariance, |
25: | string $name, |
26: | StrictMixedType $bound, |
27: | ?Type $default, |
28: | ) |
29: | { |
30: | $this->scope = $scope; |
31: | $this->strategy = $templateTypeStrategy; |
32: | $this->variance = $templateTypeVariance; |
33: | $this->name = $name; |
34: | $this->bound = $bound; |
35: | $this->default = $default; |
36: | } |
37: | |
38: | public function isSuperTypeOfMixed(MixedType $type): IsSuperTypeOfResult |
39: | { |
40: | return $this->isSuperTypeOf($type); |
41: | } |
42: | |
43: | public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult |
44: | { |
45: | return $this->isSubTypeOf($acceptingType)->toAcceptsResult(); |
46: | } |
47: | |
48: | } |
49: | |