Skip to content

Commit 3e08dae

Browse files
committed
Replace PHP CS Fixer with Simplify ECS
1 parent e211084 commit 3e08dae

File tree

4 files changed

+100
-3
lines changed

4 files changed

+100
-3
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
/.editorconfig export-ignore
55
/.gitattributes export-ignore
66
/.gitignore export-ignore
7+
/ecs.php export-ignore
78
/phpunit.xml.dist export-ignore
89
/tests export-ignore

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/build
22
/vendor
33

4-
/.php_cs
5-
/.php_cs.cache
64
/.phpunit.result.cache
75
/composer.lock
86
/google-service-account.json

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"require-dev": {
2121
"orchestra/testbench": "^4.0|^5.0|^6.0",
22-
"friendsofphp/php-cs-fixer": "^2.16"
22+
"symplify/easy-coding-standard": "^10.0"
2323
},
2424
"autoload": {
2525
"psr-4": {

ecs.php

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?php
2+
3+
/**
4+
* @noinspection DevelopmentDependenciesUsageInspection
5+
* @noinspection TransitiveDependenciesUsageInspection
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
use PhpCsFixer\Fixer\Alias\NoAliasFunctionsFixer;
11+
use PhpCsFixer\Fixer\ClassNotation\FinalInternalClassFixer;
12+
use PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer;
13+
use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer;
14+
use PhpCsFixer\Fixer\FunctionNotation\FopenFlagsFixer;
15+
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
16+
use PhpCsFixer\Fixer\FunctionNotation\NoUselessSprintfFixer;
17+
use PhpCsFixer\Fixer\FunctionNotation\UseArrowFunctionsFixer;
18+
use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer;
19+
use PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer;
20+
use PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer;
21+
use PhpCsFixer\Fixer\Phpdoc\PhpdocTypesOrderFixer;
22+
use PhpCsFixer\Fixer\PhpUnit\PhpUnitInternalClassFixer;
23+
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer;
24+
use PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer;
25+
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer;
26+
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestCaseStaticMethodCallsFixer;
27+
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestClassRequiresCoversFixer;
28+
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
29+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
30+
use Symplify\EasyCodingStandard\ValueObject\Option;
31+
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
32+
33+
return static function (ContainerConfigurator $containerConfigurator): void {
34+
$parameters = $containerConfigurator->parameters();
35+
36+
$parameters->set(Option::INDENTATION, 'spaces');
37+
$parameters->set(Option::LINE_ENDING, "\n");
38+
$parameters->set(Option::PARALLEL, true);
39+
$parameters->set(Option::PATHS, [
40+
__DIR__.'/src',
41+
__DIR__.'/tests',
42+
__FILE__,
43+
]);
44+
45+
$containerConfigurator->import(SetList::PHP_CS_FIXER);
46+
$containerConfigurator->import(SetList::PHP_CS_FIXER_RISKY);
47+
48+
$parameters->set(Option::SKIP, [
49+
FinalInternalClassFixer::class => [
50+
__DIR__.'/src',
51+
],
52+
PhpdocToCommentFixer::class,
53+
PhpUnitTestClassRequiresCoversFixer::class,
54+
PhpUnitStrictFixer::class,
55+
]);
56+
57+
$services = $containerConfigurator->services();
58+
$services->set(DeclareStrictTypesFixer::class);
59+
$services->set(FopenFlagsFixer::class)->call('configure', [[
60+
'b_mode' => true,
61+
]]);
62+
$services->set(NativeFunctionInvocationFixer::class)->call('configure', [[
63+
'include' => [
64+
'@all',
65+
],
66+
'scope' => 'all',
67+
'strict' => true,
68+
]]);
69+
$services->set(NoAliasFunctionsFixer::class);
70+
$services->set(NoSuperfluousPhpdocTagsFixer::class)->call('configure', [[
71+
'allow_mixed' => true,
72+
'allow_unused_params' => false,
73+
]]);
74+
$services->set(NoUselessSprintfFixer::class);
75+
$services->set(OrderedClassElementsFixer::class)->call('configure', [[
76+
'order' => ['use_trait'],
77+
]]);
78+
$services->set(PhpdocAlignFixer::class)->call('configure', [[
79+
'align' => 'left',
80+
]]);
81+
$services->set(PhpdocTypesOrderFixer::class)->call('configure', [[
82+
'sort_algorithm' => 'none',
83+
'null_adjustment' => 'always_last',
84+
]]);
85+
$services->set(PhpUnitInternalClassFixer::class);
86+
$services->set(PhpUnitMethodCasingFixer::class)->call('configure', [['case' => 'snake_case']]);
87+
$services->set(PhpUnitTestAnnotationFixer::class)->call('configure', [['style' => 'annotation']]);
88+
$services->set(UseArrowFunctionsFixer::class);
89+
$services->set(YodaStyleFixer::class)->call('configure', [[
90+
'equal' => null,
91+
'identical' => null,
92+
'less_and_greater' => null,
93+
'always_move_variable' => false,
94+
]]);
95+
$services->set(PhpUnitTestCaseStaticMethodCallsFixer::class)->call('configure', [[
96+
'call_type' => 'this',
97+
]]);
98+
};

0 commit comments

Comments
 (0)