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: /** @api */
9: final class TemplateGenericObjectType extends GenericObjectType implements TemplateType
10: {
11:
12: use UndecidedComparisonCompoundTypeTrait;
13: /** @use TemplateTypeTrait<GenericObjectType> */
14: use TemplateTypeTrait;
15:
16: /**
17: * @param non-empty-string $name
18: */
19: public function __construct(
20: TemplateTypeScope $scope,
21: TemplateTypeStrategy $templateTypeStrategy,
22: TemplateTypeVariance $templateTypeVariance,
23: string $name,
24: GenericObjectType $bound,
25: ?Type $default,
26: )
27: {
28: parent::__construct($bound->getClassName(), $bound->getTypes(), null, null, $bound->getVariances());
29:
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 recreate(string $className, array $types, ?Type $subtractedType, array $variances = []): GenericObjectType
39: {
40: return new self(
41: $this->scope,
42: $this->strategy,
43: $this->variance,
44: $this->name,
45: $this->getBound(),
46: $this->default,
47: );
48: }
49:
50: }
51: