Skip to content

Commit 7cfc530

Browse files
committed
[BCB] Constructor parameter $isEquality in AssertTag*ValueNode made required
1 parent f963555 commit 7cfc530

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

UPGRADING.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ If these parts are supposed to be PHPDoc descriptions, you need to put whitespac
7676
/** @return array{foo: int} } */
7777
```
7878

79-
## Type aliases with invalid types are preserved
79+
### Type aliases with invalid types are preserved
8080

8181
In phpdoc-parser 1.x, invalid type alias syntax was represented as [`InvalidTagValueNode`](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Ast.PhpDoc.InvalidTagValueNode.html), losing information about a type alias being present.
8282

@@ -88,19 +88,19 @@ In phpdoc-parser 1.x, invalid type alias syntax was represented as [`InvalidTagV
8888

8989
This `@phpstan-type` is missing the actual type to alias. In phpdoc-parser 2.0 this is now represented as [`TypeAliasTagValueNode`](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Ast.PhpDoc.TypeAliasTagValueNode.html) (instead of `InvalidTagValueNode`) with [`InvalidTypeNode`](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Ast.Type.InvalidTypeNode.html) in place of the type.
9090

91-
## Removal of QuoteAwareConstExprStringNode
91+
### Removal of QuoteAwareConstExprStringNode
9292

9393
The class [QuoteAwareConstExprStringNode](https://phpstan.github.io/phpdoc-parser/1.23.x/PHPStan.PhpDocParser.Ast.ConstExpr.QuoteAwareConstExprStringNode.html) has been removed.
9494

9595
Instead, [ConstExprStringNode](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Ast.ConstExpr.ConstExprStringNode.html) gained information about the kind of quotes being used.
9696

97-
## Removed 2nd parameter of `ConstExprParser::parse()` (`$trimStrings`)
97+
### Removed 2nd parameter of `ConstExprParser::parse()` (`$trimStrings`)
9898

9999
`ConstExprStringNode::$value` now contains unescaped values without surrounding `''` or `""` quotes.
100100

101101
Use `ConstExprStringNode::__toString()` or [`Printer`](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Printer.Printer.html) to get the escaped value along with surrounding quotes.
102102

103-
## Text between tags always belongs to description
103+
### Text between tags always belongs to description
104104

105105
Multi-line descriptions between tags were previously represented as separate [PhpDocTextNode](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Ast.PhpDoc.PhpDocTextNode.html):
106106

@@ -113,3 +113,7 @@ Multi-line descriptions between tags were previously represented as separate [Ph
113113
```
114114

115115
The line with `some text in the middle` in phpdoc-parser 2.0 is now part of the description of the first `@param` tag.
116+
117+
### Minor BC breaks
118+
119+
* Constructor parameter `$isEquality` in `AssertTag*ValueNode` made required

src/Ast/PhpDoc/AssertTagMethodValueNode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AssertTagMethodValueNode implements PhpDocTagValueNode
2424
/** @var string (may be empty) */
2525
public string $description;
2626

27-
public function __construct(TypeNode $type, string $parameter, string $method, bool $isNegated, string $description, bool $isEquality = false)
27+
public function __construct(TypeNode $type, string $parameter, string $method, bool $isNegated, string $description, bool $isEquality)
2828
{
2929
$this->type = $type;
3030
$this->parameter = $parameter;

src/Ast/PhpDoc/AssertTagPropertyValueNode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AssertTagPropertyValueNode implements PhpDocTagValueNode
2424
/** @var string (may be empty) */
2525
public string $description;
2626

27-
public function __construct(TypeNode $type, string $parameter, string $property, bool $isNegated, string $description, bool $isEquality = false)
27+
public function __construct(TypeNode $type, string $parameter, string $property, bool $isNegated, string $description, bool $isEquality)
2828
{
2929
$this->type = $type;
3030
$this->parameter = $parameter;

src/Ast/PhpDoc/AssertTagValueNode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AssertTagValueNode implements PhpDocTagValueNode
2222
/** @var string (may be empty) */
2323
public string $description;
2424

25-
public function __construct(TypeNode $type, string $parameter, bool $isNegated, string $description, bool $isEquality = false)
25+
public function __construct(TypeNode $type, string $parameter, bool $isNegated, string $description, bool $isEquality)
2626
{
2727
$this->type = $type;
2828
$this->parameter = $parameter;

tests/PHPStan/Parser/PhpDocParserTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -4667,6 +4667,7 @@ public function provideAssertTagsData(): Iterator
46674667
'$var',
46684668
false,
46694669
'',
4670+
false,
46704671
),
46714672
),
46724673
]),
@@ -4683,6 +4684,7 @@ public function provideAssertTagsData(): Iterator
46834684
'$var',
46844685
false,
46854686
'',
4687+
false,
46864688
),
46874689
),
46884690
]),
@@ -4699,6 +4701,7 @@ public function provideAssertTagsData(): Iterator
46994701
'$var',
47004702
false,
47014703
'assert Type to $var',
4704+
false,
47024705
),
47034706
),
47044707
]),
@@ -4718,6 +4721,7 @@ public function provideAssertTagsData(): Iterator
47184721
'$var',
47194722
false,
47204723
'',
4724+
false,
47214725
),
47224726
),
47234727
]),
@@ -4735,6 +4739,7 @@ public function provideAssertTagsData(): Iterator
47354739
'method',
47364740
false,
47374741
'',
4742+
false,
47384743
),
47394744
),
47404745
]),
@@ -4752,6 +4757,7 @@ public function provideAssertTagsData(): Iterator
47524757
'property',
47534758
false,
47544759
'',
4760+
false,
47554761
),
47564762
),
47574763
]),
@@ -4768,6 +4774,7 @@ public function provideAssertTagsData(): Iterator
47684774
'$this',
47694775
false,
47704776
'',
4777+
false,
47714778
),
47724779
),
47734780
]),
@@ -4784,6 +4791,7 @@ public function provideAssertTagsData(): Iterator
47844791
'$this',
47854792
false,
47864793
'assert Type to $this',
4794+
false,
47874795
),
47884796
),
47894797
]),
@@ -4808,6 +4816,7 @@ public function provideAssertTagsData(): Iterator
48084816
'$this',
48094817
false,
48104818
'',
4819+
false,
48114820
),
48124821
),
48134822
]),
@@ -4825,6 +4834,7 @@ public function provideAssertTagsData(): Iterator
48254834
'method',
48264835
false,
48274836
'',
4837+
false,
48284838
),
48294839
),
48304840
]),
@@ -4842,6 +4852,7 @@ public function provideAssertTagsData(): Iterator
48424852
'property',
48434853
false,
48444854
'',
4855+
false,
48454856
),
48464857
),
48474858
]),
@@ -4858,6 +4869,7 @@ public function provideAssertTagsData(): Iterator
48584869
'$var',
48594870
false,
48604871
'',
4872+
false,
48614873
),
48624874
),
48634875
]),
@@ -4874,6 +4886,7 @@ public function provideAssertTagsData(): Iterator
48744886
'$var',
48754887
false,
48764888
'',
4889+
false,
48774890
),
48784891
),
48794892
]),
@@ -4890,6 +4903,7 @@ public function provideAssertTagsData(): Iterator
48904903
'$var',
48914904
true,
48924905
'',
4906+
false,
48934907
),
48944908
),
48954909
]),

0 commit comments

Comments
 (0)