-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs.php
94 lines (92 loc) · 2.8 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
<?php
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;
use PhpCsFixer\Fixer\CastNotation\CastSpacesFixer;
use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer;
use PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer;
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
use PhpCsFixer\Fixer\LanguageConstruct\NullableTypeDeclarationFixer;
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
use PhpCsFixer\Fixer\StringNotation\ExplicitStringVariableFixer;
use PhpCsFixer\Fixer\Whitespace\BlankLineBeforeStatementFixer;
use Presta\BehatEvaluator\Adapter\ScalarAdapter;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer;
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
return ECSConfig::configure()
->withPaths(
[
__DIR__ . '/src',
__DIR__ . '/tests',
],
)
->withPreparedSets(
psr12: true,
arrays: true,
comments: true,
docblocks: true,
namespaces: true,
phpunit: true,
strict: true,
)
->withConfiguredRule(
BlankLineBeforeStatementFixer::class,
[
'statements' => ['case', 'continue', 'declare', 'default', 'return', 'throw', 'try'],
],
)
->withConfiguredRule(
CastSpacesFixer::class,
[
'space' => 'none',
],
)
->withConfiguredRule(
ForbiddenFunctionsSniff::class,
[
'forbiddenFunctions' => ['dump' => null, 'dd' => null, 'var_dump' => null, 'die' => null],
],
)
->withConfiguredRule(
LineLengthFixer::class,
[
LineLengthFixer::INLINE_SHORT_LINES => false,
],
)
->withConfiguredRule(
NativeFunctionInvocationFixer::class,
[
'scope' => 'namespaced',
'include' => ['@all'],
],
)
->withConfiguredRule(
NullableTypeDeclarationFixer::class,
[
'syntax' => 'union',
],
)
->withConfiguredRule(
YodaStyleFixer::class,
[
'equal' => true,
'identical' => true,
'less_and_greater' => false,
],
)
->withRules([
FunctionDeclarationFixer::class,
])
->withSkip(
[
ArrayListItemNewlineFixer::class,
ArrayOpenerAndCloserNewlineFixer::class,
ExplicitStringVariableFixer::class,
StandaloneLineInMultilineArrayFixer::class,
StrictComparisonFixer::class => [
'src/Adapter/ScalarAdapter.php',
],
],
)
;