1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Type\Generic;
4:
5: use PHPStan\Type\Constant\ConstantIntegerType;
6: use PHPStan\Type\Traits\UndecidedComparisonCompoundTypeTrait;
7: use PHPStan\Type\Type;
8:
9: /** @api */
10: final class TemplateConstantIntegerType extends ConstantIntegerType implements TemplateType
11: {
12:
13: /** @use TemplateTypeTrait<ConstantIntegerType> */
14: use TemplateTypeTrait;
15: use UndecidedComparisonCompoundTypeTrait;
16:
17: /**
18: * @param non-empty-string $name
19: */
20: public function __construct(
21: TemplateTypeScope $scope,
22: TemplateTypeStrategy $templateTypeStrategy,
23: TemplateTypeVariance $templateTypeVariance,
24: string $name,
25: ConstantIntegerType $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: