1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Type\Generic; |
4: | |
5: | use PHPStan\Type\Constant\ConstantStringType; |
6: | use PHPStan\Type\Traits\UndecidedComparisonCompoundTypeTrait; |
7: | use PHPStan\Type\Type; |
8: | |
9: | |
10: | final class TemplateConstantStringType extends ConstantStringType implements TemplateType |
11: | { |
12: | |
13: | |
14: | use TemplateTypeTrait; |
15: | use UndecidedComparisonCompoundTypeTrait; |
16: | |
17: | |
18: | |
19: | |
20: | public function __construct( |
21: | TemplateTypeScope $scope, |
22: | TemplateTypeStrategy $templateTypeStrategy, |
23: | TemplateTypeVariance $templateTypeVariance, |
24: | string $name, |
25: | ConstantStringType $bound, |
26: | ?Type $default, |
27: | ) |
28: | { |
29: | parent::__construct($bound->getValue()); |
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: | protected function shouldGeneralizeInferredType(): bool |
39: | { |
40: | return false; |
41: | } |
42: | |
43: | } |
44: | |