Skip to content

Commit d7af94f

Browse files
committed
bump to php-parser 5.4
1 parent 5a24d2f commit d7af94f

File tree

15 files changed

+49
-44
lines changed

15 files changed

+49
-44
lines changed

.github/workflows/code_analysis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# see https://github.com/shivammathur/setup-php
4545
- uses: shivammathur/setup-php@v2
4646
with:
47-
php-version: 8.1
47+
php-version: 8.2
4848
coverage: none
4949

5050
# composer install cache - https://github.com/ramsey/composer-install

composer.json

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
"description": "Print Symfony services array with configuration to to plain PHP file format thanks to this simple php-parser wrapper",
44
"license": "MIT",
55
"require": {
6-
"php": ">=8.1",
6+
"php": ">=8.2",
77
"nette/utils": "^3.2",
8-
"nikic/php-parser": "^4.18",
8+
"nikic/php-parser": "^5.3",
99
"symfony/yaml": "^6.4"
1010
},
1111
"require-dev": {
1212
"myclabs/php-enum": "^1.8",
13-
"phpstan/extension-installer": "^1.3",
13+
"phpstan/extension-installer": "^1.4",
14+
"phpstan/phpstan": "^2.1",
1415
"phpunit/phpunit": "^10.5",
15-
"rector/rector": "^0.18.12",
16-
"symplify/easy-coding-standard": "^12.0",
16+
"rector/rector": "^2.0",
17+
"phpecs/phpecs": "^2.0",
1718
"symplify/easy-testing": "^11.1",
18-
"symplify/phpstan-extensions": "^11.2",
19-
"tomasvotruba/class-leak": "^0.2"
19+
"symplify/phpstan-extensions": "^12.0",
20+
"tomasvotruba/class-leak": "^2.0"
2021
},
2122
"autoload": {
2223
"psr-4": {
@@ -32,20 +33,14 @@
3233
"tests/Printer/SmartPhpConfigPrinter/Source/custom_inline_object_function.php"
3334
]
3435
},
35-
"extra": {
36-
"branch-alias": {
37-
"dev-main": "11.2-dev"
38-
}
39-
},
4036
"scripts": {
4137
"check-cs": "vendor/bin/ecs check --ansi",
4238
"fix-cs": "vendor/bin/ecs check --fix --ansi",
43-
"phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify",
39+
"phpstan": "vendor/bin/phpstan analyse --ansi",
4440
"rector": "vendor/bin/rector process --dry-run --ansi"
4541
},
4642
"config": {
4743
"sort-packages": true,
48-
"platform-check": false,
4944
"allow-plugins": {
5045
"cweagans/composer-patches": true,
5146
"phpstan/extension-installer": true

ecs.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@
33
declare(strict_types=1);
44

55
use Symplify\EasyCodingStandard\Config\ECSConfig;
6-
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
76

8-
return static function (ECSConfig $ecsConfig): void {
9-
$ecsConfig->paths([
10-
__DIR__ . '/ecs.php',
11-
__DIR__ . '/rector.php',
7+
return ECSConfig::configure()
8+
->withPaths([
129
__DIR__ . '/src',
1310
__DIR__ . '/tests',
14-
]);
15-
16-
$ecsConfig->sets([
17-
SetList::COMMON,
18-
SetList::PSR_12,
19-
]);
20-
};
11+
])
12+
->withRootFiles()
13+
->withPreparedSets(common: true, psr12: true);

phpstan.neon

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
parameters:
2-
level: 6
2+
level: 8
3+
4+
errorFormat: symplify
5+
treatPhpDocTypesAsCertain: false
36

47
paths:
58
- src
@@ -11,4 +14,11 @@ parameters:
1114
- '*/tests/**/data/*'
1215

1316
ignoreErrors:
14-
- '#Parameter \#1 \$items of class PhpParser\\Node\\Expr\\Array_ constructor expects array<PhpParser\\Node\\Expr\\ArrayItem\|null>, array<PhpParser\\Node\\Arg> given#'
17+
18+
# php version depends on runtime
19+
-
20+
message: '#Comparison operation ">=" between int<(.*?), 80499> and 80000 is always true#'
21+
path: src/NodeFactory/ArgsNodeFactory.php
22+
23+
# unclear what to do
24+
- '#Parameter \#1 \$items of class PhpParser\\Node\\Expr\\Array_ constructor expects array<PhpParser\\Node\\ArrayItem>, array<PhpParser\\Node\\Arg> given#'

src/ExprResolver/TaggedReturnsCloneResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace Symplify\PhpConfigPrinter\ExprResolver;
66

7+
use PhpParser\Node\ArrayItem;
78
use PhpParser\Node\Expr\Array_;
8-
use PhpParser\Node\Expr\ArrayItem;
99
use Symfony\Component\Yaml\Tag\TaggedValue;
1010
use Symplify\PhpConfigPrinter\ValueObject\FunctionName;
1111

src/NodeFactory/ArgsNodeFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
use PhpParser\BuilderHelpers;
88
use PhpParser\Node;
99
use PhpParser\Node\Arg;
10+
use PhpParser\Node\ArrayItem;
1011
use PhpParser\Node\Expr;
1112
use PhpParser\Node\Expr\Array_;
12-
use PhpParser\Node\Expr\ArrayItem;
1313
use PhpParser\Node\Expr\FuncCall;
1414
use PhpParser\Node\Identifier;
1515
use PhpParser\Node\Name;
@@ -171,7 +171,7 @@ private function resolveArgs(array $args, mixed $key, Expr $expr, bool $isForCon
171171
{
172172
if (is_string($key) && $isForConfig) {
173173
$key = $this->resolveExpr($key);
174-
$args[] = new Arg(new ArrayItem($expr, $key));
174+
$args[] = new Arg(new Array_([new ArrayItem($expr, $key)]));
175175

176176
return $args;
177177
}

src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
use Nette\Utils\Json;
88
use PhpParser\Node\Arg;
9+
use PhpParser\Node\ArrayItem;
910
use PhpParser\Node\Expr;
1011
use PhpParser\Node\Expr\Array_;
11-
use PhpParser\Node\Expr\ArrayItem;
1212
use PhpParser\Node\Expr\Assign;
1313
use PhpParser\Node\Expr\BinaryOp\Identical;
1414
use PhpParser\Node\Expr\MethodCall;
@@ -66,7 +66,7 @@ private function createClosureStmts(array $yamlData): array
6666
}
6767

6868
/**
69-
* @param array<string, mixed[]> $yamlData
69+
* @param array<string|int, mixed[]> $yamlData
7070
* @return Stmt[]
7171
*/
7272
private function createStmtsFromCaseConverters(array $yamlData): array

src/NodeFactory/NewValueObjectFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function create(object $valueObject): New_ | StaticCall
3131
}
3232

3333
/**
34+
* @param class-string $valueObjectClass
3435
* @return mixed[]
3536
*/
3637
private function resolvePropertyValuesFromValueObject(string $valueObjectClass, object $valueObject): array

src/NodeModifier/SingleFactoryReferenceNodeModifier.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
use Nette\Utils\Strings;
88
use PhpParser\Node\Arg;
9+
use PhpParser\Node\ArrayItem;
910
use PhpParser\Node\Expr\Array_;
10-
use PhpParser\Node\Expr\ArrayItem;
1111
use PhpParser\Node\Expr\FuncCall;
1212
use PhpParser\Node\Name\FullyQualified;
1313
use PhpParser\Node\Scalar\String_;
@@ -47,10 +47,6 @@ public function modifyArgs(array $args): void
4747
}
4848

4949
$singleArrayItem = $singleArgValue->items[0];
50-
if (! $singleArrayItem instanceof ArrayItem) {
51-
return;
52-
}
53-
5450
if (! $singleArrayItem->value instanceof String_) {
5551
return;
5652
}

src/PhpParser/NodeFactory/ConfiguratorClosureNodeFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace Symplify\PhpConfigPrinter\PhpParser\NodeFactory;
66

77
use PhpParser\Node\Arg;
8+
use PhpParser\Node\ArrayItem;
89
use PhpParser\Node\Expr;
910
use PhpParser\Node\Expr\Array_;
10-
use PhpParser\Node\Expr\ArrayItem;
1111
use PhpParser\Node\Expr\Closure;
1212
use PhpParser\Node\Expr\MethodCall;
1313
use PhpParser\Node\Expr\Variable;
@@ -167,7 +167,7 @@ private function replaceArrayArgWithMergedArrayItems(array $extensionNodesByExte
167167

168168
/**
169169
* @param Expr[][] $extensionExprs
170-
* @return array<ArrayItem|null>
170+
* @return array<ArrayItem>
171171
*/
172172
private function resolveMergedArrayItems(array $extensionExprs): array
173173
{

0 commit comments

Comments
 (0)