Skip to content

Commit 5d901e4

Browse files
committed
Easy Coding Standard instead of PHP CS Fixer
1 parent fc003af commit 5d901e4

6 files changed

Lines changed: 37 additions & 59 deletions

File tree

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
.gitattributes export-ignore
22
.gitignore export-ignore
3-
.php-cs-fixer.php export-ignore
43
/.github export-ignore
54
/assets/src export-ignore
65
/assets/babel.config.js export-ignore
76
/assets/tsconfig.json export-ignore
87
/tests export-ignore
8+
ecs.php export-ignore
99
demo.gif export-ignore
1010
phpstan.neon export-ignore
1111
phpstan-baseline.neon export-ignore

.github/workflows/coding-standards.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
branches: ['1.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:
@@ -30,5 +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'
33+
- name: Run Easy Coding Standard
34+
run: 'vendor/bin/ecs --output-format=checkstyle | cs2pr'

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
/assets/yarn.lock
33
/var
44
/vendor
5-
.php_cs.cache
65
.phpunit.result.cache
76
composer.lock

.php-cs-fixer.php

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

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@
1919
"symfony/translation": "^6.4 || ^7.0"
2020
},
2121
"require-dev": {
22-
"friendsofphp/php-cs-fixer": "^3.86.0",
2322
"phpstan/phpstan": "^2.1.22",
2423
"phpstan/phpstan-deprecation-rules": "^2.0.3",
2524
"phpunit/phpunit": "^11.1.3",
2625
"symfony/asset-mapper": "^6.4 || ^7.0",
2726
"symfony/framework-bundle": "^6.4 || ^7.0",
28-
"symfony/twig-bundle": "^6.4 || ^7.0"
27+
"symfony/twig-bundle": "^6.4 || ^7.0",
28+
"symplify/easy-coding-standard": "^12.5.24"
2929
},
3030
"scripts": {
3131
"ci": [
3232
"@cs:dry",
3333
"@phpstan",
3434
"@phpunit"
3535
],
36-
"cs:dry": "vendor/bin/php-cs-fixer fix --diff --dry-run --no-interaction --ansi",
37-
"cs:fix": "vendor/bin/php-cs-fixer fix --ansi",
36+
"cs:dry": "vendor/bin/ecs",
37+
"cs:fix": "vendor/bin/ecs --fix",
3838
"phpstan": "vendor/bin/phpstan analyse --ansi",
3939
"phpunit": "vendor/bin/phpunit --coverage-html=var/html-coverage --colors=auto"
4040
},

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+
;

0 commit comments

Comments
 (0)