Skip to content

Commit 5cb4694

Browse files
authored
Merge pull request #6 from symplify/tv-bump-deps
bump to php-parser 5.4
2 parents 5a24d2f + bebe16f commit 5cb4694

File tree

50 files changed

+178
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+178
-189
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#'

rector.php

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,16 @@
44

55
use Rector\Config\RectorConfig;
66
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
7-
use Rector\PHPUnit\Set\PHPUnitSetList;
8-
use Rector\Set\ValueObject\LevelSetList;
9-
use Rector\Set\ValueObject\SetList;
107

11-
return static function (RectorConfig $rectorConfig): void {
12-
$rectorConfig->sets([
13-
PHPUnitSetList::PHPUNIT_100,
14-
SetList::CODE_QUALITY,
15-
SetList::DEAD_CODE,
16-
LevelSetList::UP_TO_PHP_81,
17-
SetList::CODING_STYLE,
18-
SetList::TYPE_DECLARATION,
19-
SetList::NAMING,
20-
SetList::PRIVATIZATION,
21-
SetList::EARLY_RETURN,
22-
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
23-
]);
24-
25-
$rectorConfig->paths([
8+
return RectorConfig::configure()
9+
->withPreparedSets(deadCode: true, codeQuality: true, codingStyle: true, typeDeclarations: true, naming: true, privatization: true)
10+
->withRootFiles()
11+
->withPhpSets()
12+
->withPaths([
2613
__DIR__ . '/src',
2714
__DIR__ . '/tests',
28-
]);
29-
30-
$rectorConfig->importNames();
31-
32-
$rectorConfig->skip([
15+
])
16+
->withSkip([
3317
'*/Source/*',
3418
'*/Fixture/*',
3519
// keep prefix
@@ -38,7 +22,7 @@
3822
__DIR__ . '/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php',
3923
],
4024

41-
// preference
42-
\Rector\CodingStyle\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector::class,
25+
// old value is needed
26+
\Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector::class,
27+
4328
]);
44-
};

src/CaseConverter/AliasCaseConverter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Symplify\PhpConfigPrinter\ValueObject\VariableName;
2222
use Symplify\PhpConfigPrinter\ValueObject\YamlKey;
2323

24-
final class AliasCaseConverter implements CaseConverterInterface
24+
final readonly class AliasCaseConverter implements CaseConverterInterface
2525
{
2626
/**
2727
* @see https://regex101.com/r/BwXkfO/2/
@@ -36,9 +36,9 @@ final class AliasCaseConverter implements CaseConverterInterface
3636
private const NAMED_ALIAS_REGEX = '#\w+\s+\$\w+#';
3737

3838
public function __construct(
39-
private readonly CommonNodeFactory $commonNodeFactory,
40-
private readonly ArgsNodeFactory $argsNodeFactory,
41-
private readonly ServiceOptionNodeFactory $serviceOptionNodeFactory,
39+
private CommonNodeFactory $commonNodeFactory,
40+
private ArgsNodeFactory $argsNodeFactory,
41+
private ServiceOptionNodeFactory $serviceOptionNodeFactory,
4242
) {
4343
}
4444

src/CaseConverter/ClassServiceCaseConverter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
use Symplify\PhpConfigPrinter\ValueObject\VariableName;
1616
use Symplify\PhpConfigPrinter\ValueObject\YamlKey;
1717

18-
final class ClassServiceCaseConverter implements CaseConverterInterface
18+
final readonly class ClassServiceCaseConverter implements CaseConverterInterface
1919
{
2020
public function __construct(
21-
private readonly ArgsNodeFactory $argsNodeFactory,
22-
private readonly ServiceOptionNodeFactory $serviceOptionNodeFactory
21+
private ArgsNodeFactory $argsNodeFactory,
22+
private ServiceOptionNodeFactory $serviceOptionNodeFactory
2323
) {
2424
}
2525

src/CaseConverter/ConfiguredServiceCaseConverter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
use Symplify\PhpConfigPrinter\ValueObject\VariableName;
1616
use Symplify\PhpConfigPrinter\ValueObject\YamlKey;
1717

18-
final class ConfiguredServiceCaseConverter implements CaseConverterInterface
18+
final readonly class ConfiguredServiceCaseConverter implements CaseConverterInterface
1919
{
2020
public function __construct(
21-
private readonly ArgsNodeFactory $argsNodeFactory,
22-
private readonly ServiceOptionNodeFactory $serviceOptionNodeFactory
21+
private ArgsNodeFactory $argsNodeFactory,
22+
private ServiceOptionNodeFactory $serviceOptionNodeFactory
2323
) {
2424
}
2525

src/CaseConverter/ImportCaseConverter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* imports: <---
2929
*/
30-
final class ImportCaseConverter implements CaseConverterInterface
30+
final readonly class ImportCaseConverter implements CaseConverterInterface
3131
{
3232
/**
3333
* @see https://regex101.com/r/hOTdIE/1
@@ -36,8 +36,8 @@ final class ImportCaseConverter implements CaseConverterInterface
3636
private const INPUT_SUFFIX_REGEX = '#\.(yml|yaml|xml)$#';
3737

3838
public function __construct(
39-
private readonly YamlArgumentSorter $yamlArgumentSorter,
40-
private readonly CommonNodeFactory $commonNodeFactory
39+
private YamlArgumentSorter $yamlArgumentSorter,
40+
private CommonNodeFactory $commonNodeFactory
4141
) {
4242
}
4343

src/CaseConverter/NameOnlyServiceCaseConverter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
use Symplify\PhpConfigPrinter\ValueObject\VariableName;
1515
use Symplify\PhpConfigPrinter\ValueObject\YamlKey;
1616

17-
final class NameOnlyServiceCaseConverter implements CaseConverterInterface
17+
final readonly class NameOnlyServiceCaseConverter implements CaseConverterInterface
1818
{
1919
public function __construct(
20-
private readonly CommonNodeFactory $commonNodeFactory
20+
private CommonNodeFactory $commonNodeFactory
2121
) {
2222
}
2323

0 commit comments

Comments
 (0)