Skip to content

Commit 08dbe82

Browse files
committed
Template tag name cannot be empty string
1 parent 745e99e commit 08dbe82

31 files changed

+160
-65
lines changed

src/PhpDoc/Tag/TemplateTag.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@
99
class TemplateTag
1010
{
1111

12+
/**
13+
* @param non-empty-string $name
14+
*/
1215
public function __construct(private string $name, private Type $bound, private TemplateTypeVariance $variance)
1316
{
1417
}
1518

19+
/**
20+
* @return non-empty-string
21+
*/
1622
public function getName(): string
1723
{
1824
return $this->name;

src/Type/CallableType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class CallableType implements CompoundType, CallableParametersAcceptor
6868
/**
6969
* @api
7070
* @param array<int, ParameterReflection>|null $parameters
71-
* @param array<string, TemplateTag> $templateTags
71+
* @param array<non-empty-string, TemplateTag> $templateTags
7272
*/
7373
public function __construct(
7474
?array $parameters = null,
@@ -89,7 +89,7 @@ public function __construct(
8989
}
9090

9191
/**
92-
* @return array<string, TemplateTag>
92+
* @return array<non-empty-string, TemplateTag>
9393
*/
9494
public function getTemplateTags(): array
9595
{

src/Type/ClosureType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ClosureType implements TypeWithClassName, CallableParametersAcceptor
7878
/**
7979
* @api
8080
* @param array<int, ParameterReflection>|null $parameters
81-
* @param array<string, TemplateTag> $templateTags
81+
* @param array<non-empty-string, TemplateTag> $templateTags
8282
* @param SimpleThrowPoint[] $throwPoints
8383
* @param SimpleImpurePoint[] $impurePoints
8484
* @param InvalidateExprNode[] $invalidateExpressions
@@ -108,7 +108,7 @@ public function __construct(
108108
}
109109

110110
/**
111-
* @return array<string, TemplateTag>
111+
* @return array<non-empty-string, TemplateTag>
112112
*/
113113
public function getTemplateTags(): array
114114
{

src/Type/Generic/TemplateArrayType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ final class TemplateArrayType extends ArrayType implements TemplateType
1313
use TemplateTypeTrait;
1414
use UndecidedComparisonCompoundTypeTrait;
1515

16+
/**
17+
* @param non-empty-string $name
18+
*/
1619
public function __construct(
1720
TemplateTypeScope $scope,
1821
TemplateTypeStrategy $templateTypeStrategy,

src/Type/Generic/TemplateBenevolentUnionType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ final class TemplateBenevolentUnionType extends BenevolentUnionType implements T
1212
/** @use TemplateTypeTrait<BenevolentUnionType> */
1313
use TemplateTypeTrait;
1414

15+
/**
16+
* @param non-empty-string $name
17+
*/
1518
public function __construct(
1619
TemplateTypeScope $scope,
1720
TemplateTypeStrategy $templateTypeStrategy,

src/Type/Generic/TemplateBooleanType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ final class TemplateBooleanType extends BooleanType implements TemplateType
1313
use TemplateTypeTrait;
1414
use UndecidedComparisonCompoundTypeTrait;
1515

16+
/**
17+
* @param non-empty-string $name
18+
*/
1619
public function __construct(
1720
TemplateTypeScope $scope,
1821
TemplateTypeStrategy $templateTypeStrategy,

src/Type/Generic/TemplateConstantArrayType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ final class TemplateConstantArrayType extends ConstantArrayType implements Templ
1313
use TemplateTypeTrait;
1414
use UndecidedComparisonCompoundTypeTrait;
1515

16+
/**
17+
* @param non-empty-string $name
18+
*/
1619
public function __construct(
1720
TemplateTypeScope $scope,
1821
TemplateTypeStrategy $templateTypeStrategy,

src/Type/Generic/TemplateConstantIntegerType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ final class TemplateConstantIntegerType extends ConstantIntegerType implements T
1313
use TemplateTypeTrait;
1414
use UndecidedComparisonCompoundTypeTrait;
1515

16+
/**
17+
* @param non-empty-string $name
18+
*/
1619
public function __construct(
1720
TemplateTypeScope $scope,
1821
TemplateTypeStrategy $templateTypeStrategy,

src/Type/Generic/TemplateConstantStringType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ final class TemplateConstantStringType extends ConstantStringType implements Tem
1313
use TemplateTypeTrait;
1414
use UndecidedComparisonCompoundTypeTrait;
1515

16+
/**
17+
* @param non-empty-string $name
18+
*/
1619
public function __construct(
1720
TemplateTypeScope $scope,
1821
TemplateTypeStrategy $templateTypeStrategy,

src/Type/Generic/TemplateFloatType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ final class TemplateFloatType extends FloatType implements TemplateType
1313
use TemplateTypeTrait;
1414
use UndecidedComparisonCompoundTypeTrait;
1515

16+
/**
17+
* @param non-empty-string $name
18+
*/
1619
public function __construct(
1720
TemplateTypeScope $scope,
1821
TemplateTypeStrategy $templateTypeStrategy,

0 commit comments

Comments
 (0)