generated from SolidWorx/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs.php
83 lines (73 loc) · 2.86 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
<?php
declare(strict_types=1);
/*
* This file is part of {PROJECT_NAME} project.
*
* (c) Pierre du Plessis <[email protected]>
*
* 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\PhpUnit\PhpUnitMethodCasingFixer;
use PhpCsFixer\Fixer\StringNotation\ExplicitStringVariableFixer;
use PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/migrations',
__DIR__ . '/rector.php',
__FILE__,
]);
$ecsConfig->sets([
SetList::PSR_12,
SetList::SPACES,
SetList::DOCBLOCK,
SetList::COMMENTS,
SetList::PHPUNIT,
SetList::NAMESPACES,
SetList::CLEAN_CODE,
]);
$ecsConfig->rules([
PhpUnitMethodCasingFixer::class,
FunctionToConstantFixer::class,
ExplicitStringVariableFixer::class,
ExplicitIndirectVariableFixer::class,
NewWithBracesFixer::class,
StandardizeIncrementFixer::class,
SelfAccessorFixer::class,
MagicConstantCasingFixer::class,
NoUselessElseFixer::class,
SingleQuoteFixer::class,
VoidReturnFixer::class,
]);
$header = <<<'EOF'
This file is part of {PROJECT_NAME} project.
(c) Pierre du Plessis <[email protected]>
This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;
$ecsConfig->ruleWithConfiguration(SingleClassElementPerStatementFixer::class, ['elements' => ['const', 'property']]);
$ecsConfig->ruleWithConfiguration(ClassDefinitionFixer::class, ['single_line' => \true]);
$ecsConfig->ruleWithConfiguration(OrderedImportsFixer::class, ['imports_order' => ['const', 'class', 'function']]);
$ecsConfig->ruleWithConfiguration(HeaderCommentFixer::class, [
'comment_type' => 'comment',
'header' => \trim($header),
'location' => 'after_declare_strict',
'separate' => 'both',
]);
};