1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Type\Generic; |
4: | |
5: | use PHPStan\Type\Traits\UndecidedComparisonCompoundTypeTrait; |
6: | use PHPStan\Type\Type; |
7: | |
8: | |
9: | final class TemplateGenericObjectType extends GenericObjectType implements TemplateType |
10: | { |
11: | |
12: | use UndecidedComparisonCompoundTypeTrait; |
13: | |
14: | use TemplateTypeTrait; |
15: | |
16: | |
17: | |
18: | |
19: | public function __construct( |
20: | TemplateTypeScope $scope, |
21: | TemplateTypeStrategy $templateTypeStrategy, |
22: | TemplateTypeVariance $templateTypeVariance, |
23: | string $name, |
24: | GenericObjectType $bound, |
25: | ) |
26: | { |
27: | parent::__construct($bound->getClassName(), $bound->getTypes(), null, null, $bound->getVariances()); |
28: | |
29: | $this->scope = $scope; |
30: | $this->strategy = $templateTypeStrategy; |
31: | $this->variance = $templateTypeVariance; |
32: | $this->name = $name; |
33: | $this->bound = $bound; |
34: | } |
35: | |
36: | protected function recreate(string $className, array $types, ?Type $subtractedType, array $variances = []): GenericObjectType |
37: | { |
38: | return new self( |
39: | $this->scope, |
40: | $this->strategy, |
41: | $this->variance, |
42: | $this->name, |
43: | $this->getBound(), |
44: | ); |
45: | } |
46: | |
47: | } |
48: | |