Skip to content

Commit 5f84c95

Browse files
committed
[BCB] Constructor parameters $expectedTokenValue and $currentTokenLine in ParserException made required
1 parent 34fa2ae commit 5f84c95

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

UPGRADING.md

+1
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,4 @@ The line with `some text in the middle` in phpdoc-parser 2.0 is now part of the
125125
* Constructor parameter `$isReference` in `ParamTagValueNode` made required
126126
* Constructor parameter `$isReference` in `TypelessParamTagValueNode` made required
127127
* Constructor parameter `$templateTypes` in `CallableTypeNode` made required
128+
* Constructor parameters `$expectedTokenValue` and `$currentTokenLine` in `ParserException` made required

src/Parser/ParserException.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ class ParserException extends Exception
2222

2323
private int $expectedTokenType;
2424

25-
private ?string $expectedTokenValue = null;
25+
private ?string $expectedTokenValue;
2626

27-
private ?int $currentTokenLine = null;
27+
private ?int $currentTokenLine;
2828

2929
public function __construct(
3030
string $currentTokenValue,
3131
int $currentTokenType,
3232
int $currentOffset,
3333
int $expectedTokenType,
34-
?string $expectedTokenValue = null,
35-
?int $currentTokenLine = null
34+
?string $expectedTokenValue,
35+
?int $currentTokenLine
3636
)
3737
{
3838
$this->currentTokenValue = $currentTokenValue;

tests/PHPStan/Ast/ToString/PhpDocToStringTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static function provideOtherCases(): Generator
137137
'#desc',
138138
new InvalidTagValueNode(
139139
'#desc',
140-
new ParserException('#desc', Lexer::TOKEN_OTHER, 11, Lexer::TOKEN_IDENTIFIER),
140+
new ParserException('#desc', Lexer::TOKEN_OTHER, 11, Lexer::TOKEN_IDENTIFIER, null, null),
141141
),
142142
];
143143

tests/PHPStan/Parser/TypeParserTest.php

+40
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ public function provideParseData(): array
536536
Lexer::TOKEN_END,
537537
6,
538538
Lexer::TOKEN_IDENTIFIER,
539+
null,
540+
null,
539541
),
540542
],
541543
[
@@ -545,6 +547,8 @@ public function provideParseData(): array
545547
Lexer::TOKEN_OTHER,
546548
8,
547549
Lexer::TOKEN_CLOSE_CURLY_BRACKET,
550+
null,
551+
null,
548552
),
549553
],
550554
[
@@ -738,6 +742,8 @@ public function provideParseData(): array
738742
Lexer::TOKEN_IDENTIFIER,
739743
16,
740744
Lexer::TOKEN_CLOSE_CURLY_BRACKET,
745+
null,
746+
null,
741747
),
742748
],
743749
[
@@ -1082,6 +1088,8 @@ public function provideParseData(): array
10821088
Lexer::TOKEN_CLOSE_ANGLE_BRACKET,
10831089
10,
10841090
Lexer::TOKEN_IDENTIFIER,
1091+
null,
1092+
null,
10851093
),
10861094
],
10871095
[
@@ -1091,6 +1099,8 @@ public function provideParseData(): array
10911099
Lexer::TOKEN_CLOSE_ANGLE_BRACKET,
10921100
14,
10931101
Lexer::TOKEN_IDENTIFIER,
1102+
null,
1103+
null,
10941104
),
10951105
],
10961106
[
@@ -1100,6 +1110,8 @@ public function provideParseData(): array
11001110
Lexer::TOKEN_COMMA,
11011111
21,
11021112
Lexer::TOKEN_CLOSE_ANGLE_BRACKET,
1113+
null,
1114+
null,
11031115
),
11041116
],
11051117
[
@@ -1109,6 +1121,8 @@ public function provideParseData(): array
11091121
Lexer::TOKEN_COMMA,
11101122
21,
11111123
Lexer::TOKEN_CLOSE_ANGLE_BRACKET,
1124+
null,
1125+
null,
11121126
),
11131127
],
11141128
[
@@ -1118,6 +1132,8 @@ public function provideParseData(): array
11181132
Lexer::TOKEN_CLOSE_ANGLE_BRACKET,
11191133
9,
11201134
Lexer::TOKEN_IDENTIFIER,
1135+
null,
1136+
null,
11211137
),
11221138
],
11231139
[
@@ -1127,6 +1143,8 @@ public function provideParseData(): array
11271143
Lexer::TOKEN_COMMA,
11281144
12,
11291145
Lexer::TOKEN_CLOSE_ANGLE_BRACKET,
1146+
null,
1147+
null,
11301148
),
11311149
],
11321150
[
@@ -1136,6 +1154,8 @@ public function provideParseData(): array
11361154
Lexer::TOKEN_COMMA,
11371155
12,
11381156
Lexer::TOKEN_CLOSE_ANGLE_BRACKET,
1157+
null,
1158+
null,
11391159
),
11401160
],
11411161
[
@@ -1330,6 +1350,8 @@ public function provideParseData(): array
13301350
Lexer::TOKEN_END,
13311351
9,
13321352
Lexer::TOKEN_IDENTIFIER,
1353+
null,
1354+
null,
13331355
),
13341356
],
13351357
[
@@ -2089,6 +2111,8 @@ public function provideParseData(): array
20892111
Lexer::TOKEN_IDENTIFIER,
20902112
14,
20912113
Lexer::TOKEN_COLON,
2114+
null,
2115+
null,
20922116
),
20932117
],
20942118
[
@@ -2114,6 +2138,8 @@ public function provideParseData(): array
21142138
Lexer::TOKEN_VARIABLE,
21152139
15,
21162140
Lexer::TOKEN_IDENTIFIER,
2141+
null,
2142+
null,
21172143
),
21182144
],
21192145
[
@@ -2151,6 +2177,8 @@ public function provideParseData(): array
21512177
Lexer::TOKEN_CLOSE_ANGLE_BRACKET,
21522178
13,
21532179
Lexer::TOKEN_IDENTIFIER,
2180+
null,
2181+
null,
21542182
),
21552183
],
21562184
[
@@ -2160,6 +2188,8 @@ public function provideParseData(): array
21602188
Lexer::TOKEN_IDENTIFIER,
21612189
16,
21622190
Lexer::TOKEN_CLOSE_ANGLE_BRACKET,
2191+
null,
2192+
null,
21632193
),
21642194
],
21652195
[
@@ -2296,6 +2326,8 @@ public function provideParseData(): array
22962326
Lexer::TOKEN_END,
22972327
7,
22982328
Lexer::TOKEN_IDENTIFIER,
2329+
null,
2330+
null,
22992331
),
23002332
],
23012333
[
@@ -2305,6 +2337,8 @@ public function provideParseData(): array
23052337
Lexer::TOKEN_OTHER,
23062338
9,
23072339
Lexer::TOKEN_COLON,
2340+
null,
2341+
null,
23082342
),
23092343
],
23102344
[
@@ -2314,6 +2348,8 @@ public function provideParseData(): array
23142348
Lexer::TOKEN_CLOSE_CURLY_BRACKET,
23152349
10,
23162350
Lexer::TOKEN_COLON,
2351+
null,
2352+
null,
23172353
),
23182354
],
23192355
[
@@ -2323,6 +2359,8 @@ public function provideParseData(): array
23232359
Lexer::TOKEN_END,
23242360
7,
23252361
Lexer::TOKEN_IDENTIFIER,
2362+
null,
2363+
null,
23262364
),
23272365
],
23282366
[
@@ -2332,6 +2370,8 @@ public function provideParseData(): array
23322370
Lexer::TOKEN_END,
23332371
7,
23342372
Lexer::TOKEN_IDENTIFIER,
2373+
null,
2374+
null,
23352375
),
23362376
],
23372377
[

0 commit comments

Comments
 (0)