-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathecs.php
More file actions
103 lines (96 loc) · 3.42 KB
/
ecs.php
File metadata and controls
103 lines (96 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
declare(strict_types=1);
/*
* This file is part of SolidWorx Toggler project.
*
* (c) SolidWorx <open-source@solidworx.co>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
use PhpCsFixer\Fixer\Casing\MagicConstantCasingFixer;
use PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer;
use PhpCsFixer\Fixer\ClassNotation\SelfAccessorFixer;
use PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer;
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer;
use PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\LanguageConstruct\ExplicitIndirectVariableFixer;
use PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer;
use PhpCsFixer\Fixer\Operator\NewWithBracesFixer;
use PhpCsFixer\Fixer\Operator\StandardizeIncrementFixer;
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer;
use PhpCsFixer\Fixer\StringNotation\ExplicitStringVariableFixer;
use PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer;
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
use Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
$header = <<<'EOF'
This file is part of SolidWorx Toggler project.
(c) SolidWorx <open-source@solidworx.co>
This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;
return ECSConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withRootFiles()
->withPreparedSets(
psr12: true,
symplify: true,
arrays: true,
comments: true,
docblocks: true,
spaces: true,
namespaces: true,
controlStructures: true,
phpunit: true,
strict: true,
cleanCode: true,
)
->withRules([
PhpUnitMethodCasingFixer::class,
FunctionToConstantFixer::class,
ExplicitStringVariableFixer::class,
ExplicitIndirectVariableFixer::class,
NewWithBracesFixer::class,
StandardizeIncrementFixer::class,
SelfAccessorFixer::class,
MagicConstantCasingFixer::class,
NoUselessElseFixer::class,
SingleQuoteFixer::class,
VoidReturnFixer::class,
])
->withConfiguredRule(SingleClassElementPerStatementFixer::class, [
'elements' => ['const', 'property'],
])
->withConfiguredRule(ClassDefinitionFixer::class, [
'single_line' => true,
])
->withConfiguredRule(OrderedImportsFixer::class, [
'imports_order' => ['const', 'class', 'function'],
])
->withConfiguredRule(HeaderCommentFixer::class, [
'comment_type' => 'comment',
'header' => trim($header),
'location' => 'after_declare_strict',
'separate' => 'both',
])
->withConfiguredRule(GeneralPhpdocAnnotationRemoveFixer::class, [
'annotations' => ['author', 'package', 'group', 'covers', 'category'],
])
->withSkip(
[
MethodChainingNewlineFixer::class,
LineLengthFixer::class,
MethodChainingIndentationFixer::class => [
__DIR__ . '/src/Symfony/DependencyInjection/Configuration.php',
],
]
)
;