forked from Spomky-Labs/otphp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs.php
100 lines (93 loc) · 4.1 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
<?php
declare(strict_types=1);
use PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer;
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer;
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer;
use PhpCsFixer\Fixer\ControlStructure\NoSuperfluousElseifFixer;
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
use PhpCsFixer\Fixer\Import\GlobalNamespaceImportFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveIssetsFixer;
use PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveUnsetsFixer;
use PhpCsFixer\Fixer\Phpdoc\AlignMultilineCommentFixer;
use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocOrderFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocTrimConsecutiveBlankLineSeparationFixer;
use PhpCsFixer\Fixer\PhpTag\LinebreakAfterOpeningTagFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestCaseStaticMethodCallsFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestClassRequiresCoversFixer;
use PhpCsFixer\Fixer\ReturnNotation\SimplifiedNullReturnFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
use PhpCsFixer\Fixer\Strict\StrictParamFixer;
use PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer;
use PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
$header = '';
return static function (ECSConfig $config) use ($header): void {
$config->import(SetList::PSR_12);
$config->import(SetList::CLEAN_CODE);
$config->import(SetList::DOCTRINE_ANNOTATIONS);
$config->import(SetList::SPACES);
$config->import(SetList::PHPUNIT);
$config->import(SetList::SYMPLIFY);
$config->import(SetList::ARRAY);
$config->import(SetList::COMMON);
$config->import(SetList::COMMENTS);
$config->import(SetList::CONTROL_STRUCTURES);
$config->import(SetList::DOCBLOCK);
$config->import(SetList::NAMESPACES);
$config->import(SetList::STRICT);
$config->rule(StrictParamFixer::class);
$config->rule(StrictComparisonFixer::class);
$config->rule(ArrayIndentationFixer::class);
$config->rule(OrderedImportsFixer::class);
$config->rule(ProtectedToPrivateFixer::class);
$config->rule(DeclareStrictTypesFixer::class);
$config->rule(NativeConstantInvocationFixer::class);
$config->rule(MbStrFunctionsFixer::class);
$config->rule(LinebreakAfterOpeningTagFixer::class);
$config->rule(CombineConsecutiveIssetsFixer::class);
$config->rule(CombineConsecutiveUnsetsFixer::class);
$config->rule(CompactNullableTypehintFixer::class);
$config->rule(NoSuperfluousElseifFixer::class);
$config->rule(NoSuperfluousPhpdocTagsFixer::class);
$config->rule(PhpdocTrimConsecutiveBlankLineSeparationFixer::class);
$config->rule(PhpdocOrderFixer::class);
$config->rule(SimplifiedNullReturnFixer::class);
$config->rule(PhpUnitTestCaseStaticMethodCallsFixer::class);
$config->ruleWithConfiguration(ArraySyntaxFixer::class, [
'syntax' => 'short',
]);
$config->ruleWithConfiguration(NativeFunctionInvocationFixer::class, [
'include' => ['@compiler_optimized'],
'scope' => 'namespaced',
'strict' => true,
]);
$config->ruleWithConfiguration(HeaderCommentFixer::class, [
'header' => $header,
]);
$config->ruleWithConfiguration(AlignMultilineCommentFixer::class, [
'comment_type' => 'all_multiline',
]);
$config->ruleWithConfiguration(PhpUnitTestAnnotationFixer::class, [
'style' => 'annotation',
]);
$config->ruleWithConfiguration(GlobalNamespaceImportFixer::class, [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
]);
$config->services()
->remove(PhpUnitTestClassRequiresCoversFixer::class)
;
$config->parallel();
$config->paths([
__DIR__.'/src',
__DIR__.'/tests',
]);
};