-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs.php
executable file
·79 lines (67 loc) · 2.54 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
<?php
declare(strict_types=1);
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer;
use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\Operator\ConcatSpaceFixer;
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer;
use PhpCsFixer\Fixer\Semicolon\MultilineWhitespaceBeforeSemicolonsFixer;
use PhpCsFixer\Fixer\Whitespace\BlankLineBeforeStatementFixer;
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
use Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ECSConfig $ecsConfig): void {
$parameters = $ecsConfig->parameters();
$parameters->set(Option::PATHS, [
__DIR__,
]);
$ecsConfig->skip(
[__DIR__ . '/var/']
);
$parameters->set(Option::PARALLEL, true);
$setList = [
SetList::ARRAY,
SetList::STRICT,
SetList::SYMPLIFY,
SetList::NAMESPACES,
SetList::PSR_12,
SetList::COMMON,
SetList::PHPUNIT,
SetList::DOCBLOCK,
SetList::CONTROL_STRUCTURES,
SetList::COMMENTS,
SetList::CLEAN_CODE,
];
foreach ($setList as $list) {
$ecsConfig->import($list);
}
$services = $ecsConfig->services();
$services->set(BlankLineBeforeStatementFixer::class);
$services->set(ArraySyntaxFixer::class)
->call('configure', [[
'syntax' => 'short',
]]);
$services->set(BinaryOperatorSpacesFixer::class)
->call('configure', [[
'default' => 'align',
]]);
$services->set(ConcatSpaceFixer::class)
->call('configure', [[
'spacing' => 'one',
]]);
$services->set(NoUnusedImportsFixer::class);
$parameters->set(Option::SKIP, [
PhpdocToCommentFixer::class => null,
MultilineWhitespaceBeforeSemicolonsFixer::class => null,
GeneralPhpdocAnnotationRemoveFixer::class => null,
MethodChainingIndentationFixer::class => null,
MethodChainingNewlineFixer::class => null,
LineLengthFixer::class => null,
IsNullFixer::class,
]);
};