/
easy-coding-standard.neon
78 lines (65 loc) · 3.18 KB
/
easy-coding-standard.neon
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
includes:
- vendor/symplify/easy-coding-standard/config/symfony-checkers.neon
- vendor/symplify/easy-coding-standard/config/php54-checkers.neon
- vendor/symplify/easy-coding-standard/config/php70-checkers.neon
- vendor/symplify/easy-coding-standard/config/php71-checkers.neon
# custom
- vendor/symplify/easy-coding-standard/config/symplify-checkers.neon
- vendor/symplify/easy-coding-standard/config/common.neon
- vendor/symplify/easy-coding-standard/config/spaces.neon
checkers:
# All rules with default values
# Rule 1: Only X indentation level per function/method (with default values)
ObjectCalisthenics\Sniffs\Metrics\MaxNestingLevelSniff:
maxNestingLevel: 2
# Rule 2: There is no "else"
- ObjectCalisthenics\Sniffs\ControlStructures\NoElseSniff
# Rule 5: Only one object operator (->) per line (with default values)
ObjectCalisthenics\Sniffs\CodeAnalysis\OneObjectOperatorPerLineSniff:
variablesHoldingAFluentInterface: ["$queryBuilder", "$containerBuilder"]
methodsStartingAFluentInterface: ["createQueryBuilder"]
methodsEndingAFluentInterface: ["execute", "getQuery"]
# Rule 6: Do not abbreviate (with default values)
ObjectCalisthenics\Sniffs\NamingConventions\ElementNameMinimalLengthSniff:
minLength: 3
allowedShortNames: ["i", "id", "to", "up"]
# Rule 7: Keep your classes small (with default values)
ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff:
maxLength: 200
ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff:
maxLength: 20
ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff:
maxCount: 10
ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff:
maxCount: 10
# Rule 9: Do not Use Getters and Setters
- ObjectCalisthenics\Sniffs\Classes\ForbiddenPublicPropertySniff
- ObjectCalisthenics\Sniffs\NamingConventions\NoSetterSniff
PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer:
equal: false
identical: false
less_and_greater: false
# Metrics
PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff:
absoluteLineLimit: 120
PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\CyclomaticComplexitySniff:
absoluteComplexity: 4
PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\NestingLevelSniff:
absoluteNestingLevel: 2
# Slevomat
- SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff
- SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff
SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff:
enableEachParameterAndReturnInspection: true
parameters:
skip:
SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff:
- *src/ObjectCalisthenics/Sniffs/*/*Sniff.php
exclude_checkers:
# Symfony ruleset
- PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer
- PhpCsFixer\Fixer\Operator\NewWithBracesFixer
- PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer
# mutually excluded
- SlevomatCodingStandard\Sniffs\ControlStructures\DisallowYodaComparisonSniff
- PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer