This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
forked from MartNijland/bpv-website-craft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecs.php
184 lines (132 loc) · 7.61 KB
/
ecs.php
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php
use PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff;
use PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff;
use PHP_CodeSniffer\Standards\PSR1\Sniffs\Files\SideEffectsSniff;
use PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff;
use PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer;
use PhpCsFixer\Fixer\Basic\BracesFixer;
use PhpCsFixer\Fixer\Basic\Psr4Fixer;
use PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer;
use PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer;
use PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer;
use PhpCsFixer\Fixer\ClassNotation\FinalInternalClassFixer;
use PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer;
use PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer;
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use PhpCsFixer\Fixer\FunctionNotation\PhpdocToReturnTypeFixer;
use PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer;
use PhpCsFixer\Fixer\Import\FullyQualifiedStrictTypesFixer;
use PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveIssetsFixer;
use PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveUnsetsFixer;
use PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer;
use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\Operator\ConcatSpaceFixer;
use PhpCsFixer\Fixer\Operator\IncrementStyleFixer;
use PhpCsFixer\Fixer\Operator\NewWithBracesFixer;
use PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\Operator\TernaryToNullCoalescingFixer;
use PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer;
use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocAnnotationWithoutDotFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocSummaryFixer;
use PhpCsFixer\Fixer\Semicolon\NoSinglelineWhitespaceBeforeSemicolonsFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer;
use PhpCsFixer\Fixer\Whitespace\BlankLineBeforeStatementFixer;
use PhpCsFixer\Fixer\Whitespace\NoTrailingWhitespaceFixer;
use Rector\CodeQuality\Rector\Include_\AbsolutizeRequireAndIncludePathRector;
use Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector;
use SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\CodingStandard\CognitiveComplexity\Rules\FunctionLikeCognitiveComplexityRule;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer;
use Symplify\CodingStandard\Fixer\Commenting\RemoveSuperfluousDocBlockWhitespaceFixer;
use Symplify\CodingStandard\Fixer\Strict\BlankLineAfterStrictTypesFixer;
use Symplify\CodingStandard\Rules\NoDebugFuncCallRule;
use Symplify\CodingStandard\Sniffs\Debug\CommentedOutCodeSniff;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/vendor/symplify/easy-coding-standard/config/set/clean-code.php');
$containerConfigurator->import(__DIR__ . '/vendor/symplify/easy-coding-standard/config/set/common.php');
$containerConfigurator->import(__DIR__ . '/vendor/symplify/easy-coding-standard/config/set/psr12.php');
$services = $containerConfigurator->services();
$services->set(AddArrayDefaultToArrayPropertyRector::class);
$services->set(StandaloneLineInMultilineArrayFixer::class);
$services->set(AbsolutizeRequireAndIncludePathRector::class);
$services->set(BlankLineAfterStrictTypesFixer::class);
$services->set(RemoveSuperfluousDocBlockWhitespaceFixer::class);
$services->set(NoDebugFuncCallRule::class);
$services->set(CommentedOutCodeSniff::class);
$services->set(FinalInternalClassFixer::class);
$services->set(MbStrFunctionsFixer::class);
$services->set(Psr4Fixer::class);
$services->set(ClassDeclarationSniff::class);
$services->set(SideEffectsSniff::class);
$services->set(CamelCapsMethodNameSniff::class);
$services->set(LowercaseCastFixer::class);
$services->set(ShortScalarCastFixer::class);
$services->set(BlankLineAfterOpeningTagFixer::class);
$services->set(NoLeadingImportSlashFixer::class);
$services->set(OrderedImportsFixer::class)
->call('configure', [['imports_order' => ['class', 'const', 'function']]]);
$services->set(DeclareEqualNormalizeFixer::class)
->call('configure', [['space' => 'none']]);
$services->set(NewWithBracesFixer::class);
$services->set(BracesFixer::class)
->call('configure', [['allow_single_line_closure' => false, 'position_after_functions_and_oop_constructs' => 'next', 'position_after_control_structures' => 'same', 'position_after_anonymous_constructs' => 'same']]);
$services->set(NoBlankLinesAfterClassOpeningFixer::class);
$services->set(VisibilityRequiredFixer::class)
->call('configure', [['elements' => ['const', 'method', 'property']]]);
$services->set(TernaryOperatorSpacesFixer::class);
$services->set(ReturnTypeDeclarationFixer::class);
$services->set(NoTrailingWhitespaceFixer::class);
$services->set(NoSinglelineWhitespaceBeforeSemicolonsFixer::class);
// $services->set(NoWhitespaceBeforeCommaInArrayFixer::class);
// $services->set(WhitespaceAfterCommaInArrayFixer::class);
$services->set(CombineConsecutiveIssetsFixer::class);
$services->set(CombineConsecutiveUnsetsFixer::class);
$services->set(PhpdocToReturnTypeFixer::class);
$services->set(FullyQualifiedStrictTypesFixer::class);
$services->set(NoSuperfluousPhpdocTagsFixer::class);
$services->set(OrderedClassElementsFixer::class)
->call('configure', [['order' => ['use_trait']]]);
$services->set(BinaryOperatorSpacesFixer::class);
$services->set(UnaryOperatorSpacesFixer::class);
$services->set(ConcatSpaceFixer::class)
->call('configure', [['spacing' => 'one']]);
$services->set(BlankLineBeforeStatementFixer::class)
->call('configure', [['statements' => ['return']]]);
$services->set(FunctionLikeCognitiveComplexityRule::class)
->property('maximumCognitiveComplexity', 40);
$services->set(TypeHintDeclarationSniff::class);
$parameters = $containerConfigurator->parameters();
$parameters->set('cache_directory', __DIR__ . '/var/cache/ecs');
$parameters->set('paths', [
__DIR__ . '/modules',
// __DIR__ . '/plugins',
]);
$parameters->set('skip', [
AssignmentInConditionSniff::class => null,
ClassAttributesSeparationFixer::class => null,
OrderedClassElementsFixer::class => null,
ConcatSpaceFixer::class => null,
IncrementStyleFixer::class => null,
UnaryOperatorSpacesFixer::class => null,
TernaryToNullCoalescingFixer::class => null,
PhpdocAnnotationWithoutDotFixer::class => null,
PhpdocSummaryFixer::class => null,
NoSuperfluousPhpdocTagsFixer::class => null,
PhpUnitMethodCasingFixer::class => null,
PhpUnitStrictFixer::class => null,
ArrayIndentationFixer::class => null,
ArrayOpenerAndCloserNewlineFixer::class => null,
// Only enable strict typing when you are 100% sure
DeclareStrictTypesFixer::class => null,
]);
// $parameters->set('only', [CamelCapsMethodNameSniff::class => ['app/*']]);
};