1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Type\Generic; |
4: | |
5: | use PHPStan\TrinaryLogic; |
6: | use PHPStan\Type\AcceptsResult; |
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: | ) |
28: | { |
29: | $this->scope = $scope; |
30: | $this->strategy = $templateTypeStrategy; |
31: | $this->variance = $templateTypeVariance; |
32: | $this->name = $name; |
33: | $this->bound = $bound; |
34: | } |
35: | |
36: | public function isSuperTypeOfMixed(MixedType $type): TrinaryLogic |
37: | { |
38: | return $this->isSuperTypeOf($type); |
39: | } |
40: | |
41: | public function isAcceptedBy(Type $acceptingType, bool $strictTypes): TrinaryLogic |
42: | { |
43: | return $this->isAcceptedWithReasonBy($acceptingType, $strictTypes)->result; |
44: | } |
45: | |
46: | public function isAcceptedWithReasonBy(Type $acceptingType, bool $strictTypes): AcceptsResult |
47: | { |
48: | return new AcceptsResult($this->isSubTypeOf($acceptingType), []); |
49: | } |
50: | |
51: | } |
52: | |