-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoding-standard.neon
More file actions
236 lines (199 loc) · 10.8 KB
/
coding-standard.neon
File metadata and controls
236 lines (199 loc) · 10.8 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
parameters:
indentation: tab
exclude_files:
- src/Kernel.php
checkers:
# use tabs over spaces
- PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\DisallowSpaceIndentSniff
# PHP code must use only UTF-8 without BOM
- PhpCsFixer\Fixer\Basic\EncodingFixer
# <?php opening tag
- PhpCsFixer\Fixer\PhpTag\FullOpeningTagFixer
# The closing ?> tag must be omitted from files containing only PHP.
- PhpCsFixer\Fixer\PhpTag\NoClosingTagFixer
# There must not be trailing whitespace at the end of lines.
- PhpCsFixer\Fixer\Whitespace\NoTrailingWhitespaceFixer
# ...and at the end of blank lines.
- PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer
# All files must end with a single blank line.
- PhpCsFixer\Fixer\Whitespace\SingleBlankLineAtEofFixer
# File name should match class name if possible.
- PhpCsFixer\Fixer\Basic\Psr4Fixer
# File ends with newline
- PHP_CodeSniffer\Standards\PSR2\Sniffs\Files\EndFileNewlineSniff
# Return types checker
- SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff
# Function oppening brace on same line
- PHP_CodeSniffer\Standards\Generic\Sniffs\Functions\OpeningFunctionBraceKernighanRitchieSniff
# Reports errors if the same class or interface name is used in multiple files.
- PHP_CodeSniffer\Standards\Generic\Sniffs\Classes\DuplicateClassNameSniff
# File Header
# empty line before namespace
- PhpCsFixer\Fixer\NamespaceNotation\SingleBlankLineBeforeNamespaceFixer
# 1 Use statement per line
- PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer
# Use statements are alphabetically ordered
- PhpCsFixer\Fixer\Import\OrderedImportsFixer
# disallow group use declarations use FooLibrary\Bar\Baz\{ ClassA, ClassB, ClassC, ClassD as Fizbo }
- SlevomatCodingStandard\Sniffs\Namespaces\DisallowGroupUseSniff
# Disallows leading backslash in use statement: use \Foo\Bar;
- SlevomatCodingStandard\Sniffs\Namespaces\UseDoesNotStartWithBackslashSniff
# Looks for unused imports from other namespaces.
SlevomatCodingStandard\Sniffs\Namespaces\UnusedUsesSniff:
searchAnnotations: yes
- PHP_CodeSniffer\Standards\PSR2\Sniffs\Classes\ClassDeclarationSniff
# Language Construct (should be placed before some other fixers)
# Functions should be used with `$strict` param set to `true`
# - PhpCsFixer\Fixer\Strict\StrictParamFixer
# replaces is_null(parameter) expression with `null === parameter`.
PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer:
use_yoda_style: no
# Calling `unset` on multiple items should be done in one call.
- PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveUnsetsFixer
# Replace all `<>` with `!=`.
- PhpCsFixer\Fixer\Operator\StandardizeNotEqualsFixer
# Include/Require and file path should be divided with a single space. File path should not be placed under brackets.
- PhpCsFixer\Fixer\ControlStructure\IncludeFixer
# Checks that control structures have the correct spacing around brackets.
- PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\ControlStructureSpacingSniff
# Arrays
# use short array fixes
PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer:
syntax: short
# use trailing command in last array element
- PhpCsFixer\Fixer\ArrayNotation\TrailingCommaInMultilineArrayFixer
# PHP single-line arrays should not have trailing comma.
- PhpCsFixer\Fixer\ArrayNotation\NoTrailingCommaInSinglelineArrayFixer
# In array declaration, there MUST NOT be a whitespace before each comma.
- PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer
# Arrays should be formatted like function/method arguments, without leading or trailing single line space.
- PhpCsFixer\Fixer\ArrayNotation\TrimArraySpacesFixer
# In array declaration, there MUST be a whitespace after each comma.
- PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer
# Strings
# Convert `heredoc` to `nowdoc` where possible.
- PhpCsFixer\Fixer\StringNotation\HeredocToNowdocFixer
# Convert double quotes to single quotes for simple strings.
- PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer
# PHP keywords must be in lower case
- PhpCsFixer\Fixer\Casing\LowercaseKeywordsFixer
# The PHP constants `true`, `false`, and `null` MUST be in lower case
- PhpCsFixer\Fixer\Casing\LowercaseConstantsFixer
# Function defined by PHP should be called using the correct casing
- PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer
# In the argument list, there must be one space after each comma, and there must no be a space before each comma
- PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer
# Inside a classy element "self" should be preferred to the class name itself.
- PhpCsFixer\Fixer\ClassNotation\SelfAccessorFixer
# class element order: constants, properties, from public to private
# PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer:
# order:
# - use_trait
# - constant
# - constant_public
# - constant_protected
# - constant_private
# - property_public
# - property_protected
# - property_private
# constant names are CAPITALIZED (manuall fixing only :()
- PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\UpperCaseConstantNameSniff
# There MUST NOT be more than one property declared per statement.
PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer:
elements: ['property']
# Methods
# They must be declared in camelCase.
- PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff
# Spaces should be properly placed in a function declaration.
- PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer
# In function arguments there must not be arguments with default values before non-default ones.
- PhpCsFixer\Fixer\FunctionNotation\NoUnreachableDefaultArgumentValueFixer
# The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words.
- PhpCsFixer\Fixer\ControlStructure\ElseifFixer
# Remove useless semicolon statements.
- PhpCsFixer\Fixer\Semicolon\NoEmptyStatementFixer
# Remove trailing commas in list() calls.
- PhpCsFixer\Fixer\ControlStructure\NoTrailingCommaInListCallFixer
# Removes unneeded parentheses around control statements.
- PhpCsFixer\Fixer\ControlStructure\NoUnneededControlParenthesesFixer
# A case should be followed by a colon and not a semicolon.
- PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer
# The structure body must be indented once.
# finds unreachable catch blocks:
# Casting
# A single space or none should be between cast and variable (int) $val
- PhpCsFixer\Fixer\CastNotation\CastSpacesFixer
# Cast should be written in lower case.
- PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer
# Replaces `intval`, `floatval`, `doubleval`, `strval` and `boolval` function calls with according type casting operator
# - PhpCsFixer\Fixer\CastNotation\ModernizeTypesCastingFixer
# Short cast `bool` using double exclamation mark should not be used
- PhpCsFixer\Fixer\CastNotation\NoShortBoolCastFixer
# Cast `(boolean)` and `(integer)` should be written as `(bool)` and `(int)`, `(double)` and `(real)` as `(float)`
- PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer
# Language Whitespace
# Binary operators should be surrounded by at least one space.
- PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer
# Unary operators should be placed adjacent to their operands.
- PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer
# No space after the opening parenthesis and before the closing parenthesis
- PhpCsFixer\Fixer\Whitespace\NoSpacesInsideParenthesisFixer
# There MUST NOT be spaces around offset braces $a[0]
- PhpCsFixer\Fixer\Whitespace\NoSpacesAroundOffsetFixer
# There should not be space before or after object `T_OBJECT_OPERATOR` `->`.
- PhpCsFixer\Fixer\Operator\ObjectOperatorWithoutWhitespaceFixer
# Standardize spaces around ternary operator.
- PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer
# Concatenation $a . $b should be spaced according configuration
PhpCsFixer\Fixer\Operator\ConcatSpaceFixer:
spacing: one
# Removes extra spaces between colon and case value.
- PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer
# Comments
# Docblocks should have the same indentation as the documented subject.
- PhpCsFixer\Fixer\Phpdoc\PhpdocIndentFixer
# There should not be any empty comments.
- PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer
# There should not be empty PHPDoc blocks.
- PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer
# Phpdocs should start and end with content, excluding the very first and last line of the docblocks.
- PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer
# short list() syntax []
PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer:
syntax: short
# declare(strict_types = 1);
- SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff
# Enforces consistent formatting of return typehints: function foo(): ?int
- SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSpacingSniff
# Checks for missing property types in phpDoc @var.
- SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff
- SlevomatCodingStandard\Sniffs\Types\EmptyLinesAroundTypeBracesSniff
#Doctrine
- PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationSpacesFixer
- PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationIndentationFixer
- PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationBracesFixer
- PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationArrayAssignmentFixer
- SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff
- SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff
- SlevomatCodingStandard\Sniffs\ControlStructures\AssignmentInConditionSniff
- SlevomatCodingStandard\Sniffs\ControlStructures\DisallowEqualOperatorsSniff
- SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullCoalesceOperatorSniff
- SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff
- SlevomatCodingStandard\Sniffs\Namespaces\UseFromSameNamespaceSniff
- SlevomatCodingStandard\Sniffs\Exceptions\DeadCatchSniff
- SlevomatCodingStandard\Sniffs\Arrays\TrailingArrayCommaSniff
- SlevomatCodingStandard\Sniffs\ControlStructures\LanguageConstructWithParenthesesSniff
- SlevomatCodingStandard\Sniffs\ControlStructures\NewWithParenthesesSniff
- SlevomatCodingStandard\Sniffs\ControlStructures\DisallowYodaComparisonSniff
- SlevomatCodingStandard\Sniffs\Namespaces\AlphabeticallySortedUsesSniff
- SlevomatCodingStandard\Sniffs\Classes\ClassConstantVisibilitySniff
- SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSpacingSniff
- SlevomatCodingStandard\Sniffs\TypeHints\NullableTypeForNullDefaultValueSniff
- SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSpacingSniff
- SlevomatCodingStandard\Sniffs\Namespaces\DisallowGroupUseSniff
- SlevomatCodingStandard\Sniffs\Namespaces\MultipleUsesPerLineSniff
- SlevomatCodingStandard\Sniffs\Namespaces\UseDoesNotStartWithBackslashSniff
- SlevomatCodingStandard\Sniffs\TypeHints\LongTypeHintsSniff
SlevomatCodingStandard\Sniffs\Types\EmptyLinesAroundTypeBracesSniff:
linesCountAfterOpeningBrace: 0
linesCountBeforeClosingBrace: 0