-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs.php
86 lines (82 loc) · 3.13 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
<?php
declare(strict_types=1);
use PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays\ArrayIndentSniff;
use PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterCastSniff;
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;
use PhpCsFixer\Fixer\ClassNotation\FinalClassFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitConstructFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitDedicateAssertFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer;
use SlevomatCodingStandard\Sniffs\Classes\ClassConstantVisibilitySniff;
use SlevomatCodingStandard\Sniffs\Classes\ClassStructureSniff;
use SlevomatCodingStandard\Sniffs\Classes\MethodSpacingSniff;
use SlevomatCodingStandard\Sniffs\Commenting\EmptyCommentSniff;
use SlevomatCodingStandard\Sniffs\Functions\StaticClosureSniff;
use SlevomatCodingStandard\Sniffs\Functions\StrictCallSniff;
use SlevomatCodingStandard\Sniffs\Namespaces\ReferenceUsedNamesOnlySniff;
use SlevomatCodingStandard\Sniffs\Namespaces\UnusedUsesSniff;
use SlevomatCodingStandard\Sniffs\Namespaces\UselessAliasSniff;
use SlevomatCodingStandard\Sniffs\Namespaces\UseSpacingSniff;
use SlevomatCodingStandard\Sniffs\Variables\DisallowSuperGlobalVariableSniff;
use Symplify\EasyCodingStandard\Config\ECSConfig;
return ECSConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withPreparedSets(
psr12: true,
cleanCode: true,
)
->withConfiguredRule(UnusedUsesSniff::class, [
'searchAnnotations' => true,
])
->withConfiguredRule(ForbiddenFunctionsSniff::class, [
'forbiddenFunctions' => [
'sizeof' => 'count', //keep the default option
'delete' => 'unset', //keep the default option
'dump' => null, //debug statement
'dd' => null, //debug statement
'var_dump' => null, //debug statement
'print_r' => null, //debug statement
'exit' => null,
],
])
->withConfiguredRule(ClassStructureSniff::class, [
'groups' => [
'uses',
'constants',
'enum cases',
'properties',
'constructor',
'static constructors',
'destructor',
'magic methods',
'all public methods',
'all protected methods',
'all private methods',
],
])
->withConfiguredRule(ReferenceUsedNamesOnlySniff::class, [
'searchAnnotations' => true,
'allowFullyQualifiedNameForCollidingClasses' => true,
])
->withRules([
ArrayIndentSniff::class,
SpaceAfterCastSniff::class,
StaticClosureSniff::class,
DisallowSuperGlobalVariableSniff::class,
ClassConstantVisibilitySniff::class,
DeclareStrictTypesFixer::class,
NoExtraBlankLinesFixer::class,
FinalClassFixer::class,
MethodSpacingSniff::class,
UselessAliasSniff::class,
EmptyCommentSniff::class,
UseSpacingSniff::class,
StrictCallSniff::class,
PhpUnitConstructFixer::class,
PhpUnitDedicateAssertFixer::class,
])
;