Skip to content

Commit 84870bf

Browse files
committed
Maintenance: GitHub actions, ECS, PHPStan & PHPUnit updates
1 parent ce1502c commit 84870bf

21 files changed

+156
-143
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.gitattributes export-ignore
22
.gitignore export-ignore
3-
.php-cs-fixer.dist.php export-ignore
43
/.github export-ignore
54
/tests export-ignore
65
/docs/CNAME export-ignore
6+
ecs.php export-ignore
77
Makefile export-ignore
88
mkdocs.yml export-ignore
99
phpstan.neon.dist export-ignore

.github/workflows/build-docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
deploy:
99
runs-on: ubuntu-24.04
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212
- uses: actions/setup-python@v4
1313
with:
1414
python-version: 3.x

.github/workflows/coding-standards.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
branches: ['5.x', '4.x', '3.x']
88

99
jobs:
10-
php-cs-fixer:
11-
name: PHP CS Fixer (PHP ${{ matrix.php-version }})
10+
easy-coding-standard:
11+
name: Easy Coding Standard (PHP ${{ matrix.php-version }})
1212
runs-on: ubuntu-24.04
1313

1414
strategy:
@@ -18,7 +18,7 @@ jobs:
1818

1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v5
2222

2323
- name: Install PHP
2424
uses: shivammathur/setup-php@v2
@@ -30,7 +30,5 @@ jobs:
3030
- name: Install Composer dependencies
3131
uses: ramsey/composer-install@v3
3232

33-
- name: Run PHP CS Fixer
34-
run: 'vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr'
35-
env:
36-
PHP_CS_FIXER_IGNORE_ENV: 1
33+
- name: Run Easy Coding Standard
34+
run: 'vendor/bin/ecs --output-format=checkstyle | cs2pr'

.github/workflows/continuous-integration.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
steps:
2727
- name: Checkout code
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@v5
2929
with:
3030
fetch-depth: 2
3131

.github/workflows/static-analysis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v5
2222

2323
- name: Install PHP
2424
uses: shivammathur/setup-php@v2

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.idea
2-
.php_cs.cache
32
.phpunit.result.cache
43
vendor
54
composer.lock

.php-cs-fixer.dist.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@
4040
"twig/twig": "^3.0"
4141
},
4242
"require-dev": {
43-
"friendsofphp/php-cs-fixer": "^3.68.1",
4443
"mikey179/vfsstream": "^1.6.11",
45-
"phpstan/phpstan": "^2.1.1",
46-
"phpstan/phpstan-deprecation-rules": "^2.0.1",
47-
"phpunit/phpunit": "^10.5.41",
48-
"symfony/browser-kit": "^6.4 || ^7.0"
44+
"phpstan/phpstan": "^2.1.22",
45+
"phpstan/phpstan-deprecation-rules": "^2.0.3",
46+
"phpunit/phpunit": "^11.5.35",
47+
"symfony/browser-kit": "^6.4 || ^7.0",
48+
"symplify/easy-coding-standard": "^12.5.24"
4949
},
5050
"scripts": {
5151
"ci": [
5252
"@cs:dry",
5353
"@phpstan",
5454
"vendor/bin/phpunit --colors=auto"
5555
],
56-
"cs:dry": "php-cs-fixer fix --diff --dry-run --no-interaction --ansi",
57-
"cs:fix": "php-cs-fixer fix --ansi",
56+
"cs:dry": "vendor/bin/ecs",
57+
"cs:fix": "vendor/bin/ecs --fix",
5858
"phpstan": "vendor/bin/phpstan analyse --ansi"
5959
},
6060
"autoload": {

ecs.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer;
6+
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
7+
use PhpCsFixer\Fixer\ReturnNotation\NoUselessReturnFixer;
8+
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
9+
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
10+
use PhpCsFixer\Fixer\Strict\StrictParamFixer;
11+
use Symplify\EasyCodingStandard\Config\ECSConfig;
12+
13+
return ECSConfig::configure()
14+
->withPaths([
15+
__DIR__ . '/src',
16+
__DIR__ . '/tests',
17+
])
18+
->withRootFiles()
19+
->withRules([
20+
NoUselessElseFixer::class,
21+
NoUselessReturnFixer::class,
22+
StrictComparisonFixer::class,
23+
StrictParamFixer::class,
24+
DeclareStrictTypesFixer::class,
25+
NoUnusedImportsFixer::class,
26+
])
27+
->withPhpCsFixerSets(perCS20: true, symfonyRisky: true)
28+
;

phpstan-baseline.neon

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,119 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Method Leapt\\\\ImBundle\\\\Doctrine\\\\Mapping\\\\Mogrify\\:\\:__construct\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
4+
message: '#^Method Leapt\\ImBundle\\Doctrine\\Mapping\\Mogrify\:\:__construct\(\) has parameter \$params with no value type specified in iterable type array\.$#'
5+
identifier: missingType.iterableValue
56
count: 1
67
path: src/Doctrine/Mapping/Mogrify.php
78

89
-
9-
message: "#^Cannot access property \\$name on ReflectionProperty\\|string\\.$#"
10+
message: '''
11+
#^Call to deprecated method getReflectionProperties\(\) of class Doctrine\\ORM\\Mapping\\ClassMetadata\:
12+
Use getPropertyAccessors\(\) instead\.$#
13+
'''
14+
identifier: method.deprecated
1015
count: 1
1116
path: src/Listener/MogrifySubscriber.php
1217

1318
-
14-
message: "#^Method Leapt\\\\ImBundle\\\\Listener\\\\MogrifySubscriber\\:\\:getFiles\\(\\) return type has no value type specified in iterable type array\\.$#"
19+
message: '#^Call to function method_exists\(\) with Doctrine\\ORM\\Mapping\\ClassMetadata\<object\> and ''getPropertyAccessors'' will always evaluate to true\.$#'
20+
identifier: function.alreadyNarrowedType
1521
count: 1
1622
path: src/Listener/MogrifySubscriber.php
1723

1824
-
19-
message: "#^Parameter \\#1 \\$format of method Leapt\\\\ImBundle\\\\Manager\\:\\:mogrify\\(\\) expects array\\|string, ReflectionProperty\\|string given\\.$#"
25+
message: '#^Call to method getUnderlyingReflector\(\) of internal interface Doctrine\\ORM\\Mapping\\PropertyAccessors\\PropertyAccessor from outside its root namespace Doctrine\.$#'
26+
identifier: method.internalInterface
27+
count: 5
28+
path: src/Listener/MogrifySubscriber.php
29+
30+
-
31+
message: '#^Cannot access property \$name on ReflectionProperty\|string\.$#'
32+
identifier: property.nonObject
33+
count: 1
34+
path: src/Listener/MogrifySubscriber.php
35+
36+
-
37+
message: '#^Method Leapt\\ImBundle\\Listener\\MogrifySubscriber\:\:getFiles\(\) return type has no value type specified in iterable type array\.$#'
38+
identifier: missingType.iterableValue
39+
count: 1
40+
path: src/Listener/MogrifySubscriber.php
41+
42+
-
43+
message: '#^Parameter \#1 \$format of method Leapt\\ImBundle\\Manager\:\:mogrify\(\) expects array\|string, ReflectionProperty\|string given\.$#'
44+
identifier: argument.type
45+
count: 1
46+
path: src/Listener/MogrifySubscriber.php
47+
48+
-
49+
message: '#^Property Leapt\\ImBundle\\Listener\\MogrifySubscriber\:\:\$config type has no value type specified in iterable type array\.$#'
50+
identifier: missingType.iterableValue
2051
count: 1
2152
path: src/Listener/MogrifySubscriber.php
2253

2354
-
24-
message: "#^Property Leapt\\\\ImBundle\\\\Listener\\\\MogrifySubscriber\\:\\:\\$config type has no value type specified in iterable type array\\.$#"
55+
message: '#^Strict comparison using \!\=\= between null and ReflectionProperty will always evaluate to true\.$#'
56+
identifier: notIdentical.alwaysTrue
2557
count: 1
2658
path: src/Listener/MogrifySubscriber.php
2759

2860
-
29-
message: "#^Method Leapt\\\\ImBundle\\\\Manager\\:\\:__construct\\(\\) has parameter \\$formats with no value type specified in iterable type array\\.$#"
61+
message: '#^Method Leapt\\ImBundle\\Manager\:\:__construct\(\) has parameter \$formats with no value type specified in iterable type array\.$#'
62+
identifier: missingType.iterableValue
3063
count: 1
3164
path: src/Manager.php
3265

3366
-
34-
message: "#^Method Leapt\\\\ImBundle\\\\Manager\\:\\:convert\\(\\) has parameter \\$format with no value type specified in iterable type array\\.$#"
67+
message: '#^Method Leapt\\ImBundle\\Manager\:\:convert\(\) has parameter \$format with no value type specified in iterable type array\.$#'
68+
identifier: missingType.iterableValue
3569
count: 1
3670
path: src/Manager.php
3771

3872
-
39-
message: "#^Method Leapt\\\\ImBundle\\\\Manager\\:\\:getCacheContent\\(\\) should return string but returns string\\|false\\.$#"
73+
message: '#^Method Leapt\\ImBundle\\Manager\:\:getCacheContent\(\) should return string but returns string\|false\.$#'
74+
identifier: return.type
4075
count: 1
4176
path: src/Manager.php
4277

4378
-
44-
message: "#^Method Leapt\\\\ImBundle\\\\Manager\\:\\:mogrify\\(\\) has parameter \\$format with no value type specified in iterable type array\\.$#"
79+
message: '#^Method Leapt\\ImBundle\\Manager\:\:mogrify\(\) has parameter \$format with no value type specified in iterable type array\.$#'
80+
identifier: missingType.iterableValue
4581
count: 1
4682
path: src/Manager.php
4783

4884
-
49-
message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\<0, max\\>\\|false given\\.$#"
85+
message: '#^Parameter \#3 \$length of function substr expects int\|null, int\<0, max\>\|false given\.$#'
86+
identifier: argument.type
5087
count: 1
5188
path: src/Manager.php
5289

5390
-
54-
message: "#^Method Leapt\\\\ImBundle\\\\Tests\\\\LeaptImTestingKernel\\:\\:configureContainer\\(\\) is unused\\.$#"
91+
message: '#^Method Leapt\\ImBundle\\Tests\\LeaptImTestingKernel\:\:configureContainer\(\) is unused\.$#'
92+
identifier: method.unused
5593
count: 1
5694
path: tests/LeaptImTestingKernel.php
5795

5896
-
59-
message: "#^Method Leapt\\\\ImBundle\\\\Tests\\\\LeaptImTestingKernel\\:\\:configureRoutes\\(\\) is unused\\.$#"
97+
message: '#^Method Leapt\\ImBundle\\Tests\\LeaptImTestingKernel\:\:configureRoutes\(\) is unused\.$#'
98+
identifier: method.unused
6099
count: 1
61100
path: tests/LeaptImTestingKernel.php
62101

63102
-
64-
message: "#^Property Leapt\\\\ImBundle\\\\Tests\\\\ManagerTest\\:\\:\\$root is never read, only written\\.$#"
103+
message: '#^Property Leapt\\ImBundle\\Tests\\ManagerTest\:\:\$root is never read, only written\.$#'
104+
identifier: property.onlyWritten
65105
count: 1
66106
path: tests/ManagerTest.php
67107

68108
-
69-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
109+
message: '#^Unreachable statement \- code above always terminates\.$#'
110+
identifier: deadCode.unreachable
70111
count: 3
71112
path: tests/ManagerTest.php
72113

73114
-
74-
message: "#^Method Leapt\\\\ImBundle\\\\Tests\\\\Mock\\\\Process\\:\\:run\\(\\) overrides @final method Symfony\\\\Component\\\\Process\\\\Process\\:\\:run\\(\\)\\.$#"
115+
message: '#^Method Leapt\\ImBundle\\Tests\\Mock\\Process\:\:run\(\) overrides @final method Symfony\\Component\\Process\\Process\:\:run\(\)\.$#'
116+
identifier: method.parentMethodFinalByPhpDoc
75117
count: 1
76118
path: tests/Mock/Process.php
77119

0 commit comments

Comments
 (0)