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: | public function __construct( |
19: | TemplateTypeScope $scope, |
20: | TemplateTypeStrategy $templateTypeStrategy, |
21: | TemplateTypeVariance $templateTypeVariance, |
22: | string $name, |
23: | StrictMixedType $bound, |
24: | ) |
25: | { |
26: | $this->scope = $scope; |
27: | $this->strategy = $templateTypeStrategy; |
28: | $this->variance = $templateTypeVariance; |
29: | $this->name = $name; |
30: | $this->bound = $bound; |
31: | } |
32: | |
33: | public function isSuperTypeOfMixed(MixedType $type): TrinaryLogic |
34: | { |
35: | return $this->isSuperTypeOf($type); |
36: | } |
37: | |
38: | public function isAcceptedBy(Type $acceptingType, bool $strictTypes): TrinaryLogic |
39: | { |
40: | return $this->isAcceptedWithReasonBy($acceptingType, $strictTypes)->result; |
41: | } |
42: | |
43: | public function isAcceptedWithReasonBy(Type $acceptingType, bool $strictTypes): AcceptsResult |
44: | { |
45: | return new AcceptsResult($this->isSubTypeOf($acceptingType), []); |
46: | } |
47: | |
48: | } |
49: | |