Skip to content

Commit 84dad1e

Browse files
committed
PHP-Parser factory make (new ParserFactory)->createForNewestSupportedVersion()
cause of CI error in PHP8.0 test.
1 parent 01d2591 commit 84dad1e

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

src/Php/PhpReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static function parseFile(string $directory, string $filename, Options $o
3333
{
3434
$code = (string)file_get_contents($filename);
3535

36-
$parser = (new ParserFactory)->createForHostVersion();
36+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
3737
try {
3838
$ast = $parser->parse($code);
3939
$nameResolver = new NameResolver();

test/PhpDocCommentTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function tearDown(): void
3030

3131
public function testDocString(): void
3232
{
33-
$parser = (new ParserFactory)->createForHostVersion();
33+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
3434
$filename = sprintf('%s/enum/TestEnum.php', $this->fixtureDir);
3535
try {
3636
$ast = $parser->parse(file_get_contents($filename));
@@ -48,7 +48,7 @@ public function testDocString(): void
4848
}
4949
public function test_enum_getDescription(): void
5050
{
51-
$parser = (new ParserFactory)->createForHostVersion();
51+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
5252
$filename = sprintf('%s/enum/TestEnum.php', $this->fixtureDir);
5353
try {
5454
$ast = $parser->parse(file_get_contents($filename));
@@ -66,7 +66,7 @@ public function test_enum_getDescription(): void
6666

6767
public function testDocStringMultiLines(): void
6868
{
69-
$parser = (new ParserFactory)->createForHostVersion();
69+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
7070
$filename = sprintf('%s/enum/TestEnum.php', $this->fixtureDir);
7171
try {
7272
$ast = $parser->parse(file_get_contents($filename));
@@ -87,7 +87,7 @@ public function testDocStringMultiLines(): void
8787

8888
public function test_getDescription(): void
8989
{
90-
$parser = (new ParserFactory)->createForHostVersion();
90+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
9191
$filename = sprintf('%s/enum/TestEnum.php', $this->fixtureDir);
9292
try {
9393
$ast = $parser->parse(file_get_contents($filename));
@@ -109,7 +109,7 @@ public function test_getDescription(): void
109109

110110
public function test_getVarType(): void
111111
{
112-
$parser = (new ParserFactory)->createForHostVersion();
112+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
113113
$filename = sprintf('%s/phpdoc/product/Product.php', $this->fixtureDir);
114114
try {
115115
$ast = $parser->parse(file_get_contents($filename));
@@ -127,7 +127,7 @@ public function test_getVarType(): void
127127
}
128128
public function test_getParamType(): void
129129
{
130-
$parser = (new ParserFactory)->createForHostVersion();
130+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
131131
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
132132
try {
133133
$ast = $parser->parse(file_get_contents($filename));
@@ -144,7 +144,7 @@ public function test_getParamType(): void
144144
}
145145
public function test_getReturnType(): void
146146
{
147-
$parser = (new ParserFactory)->createForHostVersion();
147+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
148148
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
149149
try {
150150
$ast = $parser->parse(file_get_contents($filename));
@@ -162,7 +162,7 @@ public function test_getReturnType(): void
162162
}
163163
public function test_getVarType_array_expression(): void
164164
{
165-
$parser = (new ParserFactory)->createForHostVersion();
165+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
166166
$filename = sprintf('%s/array-expression-in-doc/product/Product.php', $this->fixtureDir);
167167
try {
168168
$ast = $parser->parse(file_get_contents($filename));
@@ -180,7 +180,7 @@ public function test_getVarType_array_expression(): void
180180
}
181181
public function test_getReturnType_array_expression(): void
182182
{
183-
$parser = (new ParserFactory)->createForHostVersion();
183+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
184184
$filename = sprintf('%s/array-expression-in-doc/product/Product.php', $this->fixtureDir);
185185
try {
186186
$ast = $parser->parse(file_get_contents($filename));
@@ -198,7 +198,7 @@ public function test_getReturnType_array_expression(): void
198198
}
199199
public function test_getClassComment(): void
200200
{
201-
$parser = (new ParserFactory)->createForHostVersion();
201+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
202202
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
203203
try {
204204
$ast = $parser->parse(file_get_contents($filename));

test/PhpTypeExpressionTest.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function tearDown(): void
2929
public function testNullableString(): void
3030
{
3131
// private ?string $nullableString;
32-
$parser = (new ParserFactory)->createForHostVersion();
32+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
3333
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
3434
try {
3535
$ast = $parser->parse(file_get_contents($filename));
@@ -50,7 +50,7 @@ public function testNullableString(): void
5050
public function testIntOrString(): void
5151
{
5252
// private int|string $intOrString;
53-
$parser = (new ParserFactory)->createForHostVersion();
53+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
5454
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
5555
try {
5656
$ast = $parser->parse(file_get_contents($filename));
@@ -74,7 +74,7 @@ public function testIntOrString(): void
7474
public function testName(): void
7575
{
7676
// private Price $price;
77-
$parser = (new ParserFactory)->createForHostVersion();
77+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
7878
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
7979
try {
8080
$ast = $parser->parse(file_get_contents($filename));
@@ -95,7 +95,7 @@ public function testName(): void
9595
public function testException(): void
9696
{
9797
// private \Exception $error;
98-
$parser = (new ParserFactory)->createForHostVersion();
98+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
9999
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
100100
try {
101101
$ast = $parser->parse(file_get_contents($filename));
@@ -116,7 +116,7 @@ public function testException(): void
116116
public function testRelated(): void
117117
{
118118
// private bar\Boo $boo;
119-
$parser = (new ParserFactory)->createForHostVersion();
119+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
120120
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
121121
try {
122122
$ast = $parser->parse(file_get_contents($filename));
@@ -137,7 +137,7 @@ public function testRelated(): void
137137
public function testAbsolute(): void
138138
{
139139
// private \hoge\fuga\product\bar\Boo $boo2;
140-
$parser = (new ParserFactory)->createForHostVersion();
140+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
141141
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
142142
try {
143143
$ast = $parser->parse(file_get_contents($filename));
@@ -159,7 +159,7 @@ public function testDocString(): void
159159
{
160160
// /** @var bur\Bon $docString */
161161
// private bar\Boo $docString;
162-
$parser = (new ParserFactory)->createForHostVersion();
162+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
163163
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
164164
try {
165165
$ast = $parser->parse(file_get_contents($filename));
@@ -181,7 +181,7 @@ public function testDocStringUnion(): void
181181
{
182182
// /** @var string|int $docStringUnion */
183183
// private $docStringUnion;
184-
$parser = (new ParserFactory)->createForHostVersion();
184+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
185185
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
186186
try {
187187
$ast = $parser->parse(file_get_contents($filename));
@@ -206,7 +206,7 @@ public function testDocStringUnion2(): void
206206
{
207207
// /** @var string|bar\Bon $docStringUnion2 */
208208
// private $docStringUnion2;
209-
$parser = (new ParserFactory)->createForHostVersion();
209+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
210210
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
211211
try {
212212
$ast = $parser->parse(file_get_contents($filename));
@@ -230,7 +230,7 @@ public function testDocStringUnion2(): void
230230
public function testMethodParameterInt(): void
231231
{
232232
// int $paramInt
233-
$parser = (new ParserFactory)->createForHostVersion();
233+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
234234
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
235235
try {
236236
$ast = $parser->parse(file_get_contents($filename));
@@ -255,7 +255,7 @@ public function testMethodParameterInt(): void
255255
public function testMethodParameterPrice(): void
256256
{
257257
// ?Price $price
258-
$parser = (new ParserFactory)->createForHostVersion();
258+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
259259
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
260260
try {
261261
$ast = $parser->parse(file_get_contents($filename));
@@ -279,7 +279,7 @@ public function testMethodParameterPrice(): void
279279
public function testMethodParameterDocString(): void
280280
{
281281
// /** @params string|int $param1 */
282-
$parser = (new ParserFactory)->createForHostVersion();
282+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
283283
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
284284
try {
285285
$ast = $parser->parse(file_get_contents($filename));
@@ -306,7 +306,7 @@ public function testMethodParameterDocString(): void
306306
public function testMethodReturnInt(): void
307307
{
308308
// /** @return int|null return val. */
309-
$parser = (new ParserFactory)->createForHostVersion();
309+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
310310
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
311311
try {
312312
$ast = $parser->parse(file_get_contents($filename));
@@ -327,7 +327,7 @@ public function testMethodReturnInt(): void
327327
public function testMethodReturnProduct(): void
328328
{
329329
// /** @return Product product (優先される情報) */
330-
$parser = (new ParserFactory)->createForHostVersion();
330+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
331331
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
332332
try {
333333
$ast = $parser->parse(file_get_contents($filename));
@@ -348,7 +348,7 @@ public function testMethodReturnProduct(): void
348348
public function testMethodReturnArray(): void
349349
{
350350
// public function method3(): array
351-
$parser = (new ParserFactory)->createForHostVersion();
351+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
352352
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
353353
try {
354354
$ast = $parser->parse(file_get_contents($filename));
@@ -369,7 +369,7 @@ public function testMethodReturnArray(): void
369369
public function testMethodParameterTag(): void
370370
{
371371
// public function method4(Tag $tag): array
372-
$parser = (new ParserFactory)->createForHostVersion();
372+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
373373
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
374374
try {
375375
$ast = $parser->parse(file_get_contents($filename));
@@ -394,7 +394,7 @@ public function testMethodParameterTag(): void
394394
public function testMethodReturnUnion(): void
395395
{
396396
// public function method5(Tag $tag): int|string
397-
$parser = (new ParserFactory)->createForHostVersion();
397+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
398398
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
399399
try {
400400
$ast = $parser->parse(file_get_contents($filename));
@@ -418,7 +418,7 @@ public function testMethodReturnUnion(): void
418418
public function testMethodReturnUnionDoc(): void
419419
{
420420
// /** @return int|string return value. */
421-
$parser = (new ParserFactory)->createForHostVersion();
421+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
422422
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
423423
try {
424424
$ast = $parser->parse(file_get_contents($filename));
@@ -442,7 +442,7 @@ public function testMethodReturnUnionDoc(): void
442442
public function testMethodReturnObjectArray(): void
443443
{
444444
// /** @return Tag[] tags */
445-
$parser = (new ParserFactory)->createForHostVersion();
445+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
446446
$filename = sprintf('%s/php8/product/Product.php', $this->fixtureDir);
447447
try {
448448
$ast = $parser->parse(file_get_contents($filename));
@@ -465,7 +465,7 @@ public function testMethodReturnObjectArray(): void
465465
public function testVarArrayAlternative(): void
466466
{
467467
// /** @var array<int, Tag> 付与されたタグ一覧 */
468-
$parser = (new ParserFactory)->createForHostVersion();
468+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
469469
$filename = sprintf('%s/phpdoc/product/Product.php', $this->fixtureDir);
470470
try {
471471
$ast = $parser->parse(file_get_contents($filename));
@@ -491,7 +491,7 @@ public function testMethodParameterAltaernativeTag(): void
491491
// * @return array<int, Tag> tags
492492
// */
493493
// public function arrayTags(array $tags): array
494-
$parser = (new ParserFactory)->createForHostVersion();
494+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
495495
$filename = sprintf('%s/phpdoc/product/Product.php', $this->fixtureDir);
496496
try {
497497
$ast = $parser->parse(file_get_contents($filename));
@@ -520,7 +520,7 @@ public function testMethodReturnAltaernativeTag(): void
520520
// * @return array<int, Tag> tags
521521
// */
522522
// public function arrayTags(array $tags): array
523-
$parser = (new ParserFactory)->createForHostVersion();
523+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
524524
$filename = sprintf('%s/phpdoc/product/Product.php', $this->fixtureDir);
525525
try {
526526
$ast = $parser->parse(file_get_contents($filename));

0 commit comments

Comments
 (0)