Skip to content

Commit 05ea64c

Browse files
Update PHP-CS-Fixer configuration
1 parent 78c3b76 commit 05ea64c

File tree

1 file changed

+47
-21
lines changed

1 file changed

+47
-21
lines changed

.php-cs-fixer.dist.php

+47-21
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
'backtick_to_shell_exec' => true,
2626
'binary_operator_spaces' => [
2727
'operators' => [
28+
'*=' => 'align_single_space_minimal',
29+
'+=' => 'align_single_space_minimal',
30+
'-=' => 'align_single_space_minimal',
31+
'/=' => 'align_single_space_minimal',
2832
'=' => 'align_single_space_minimal',
2933
'=>' => 'align_single_space_minimal',
3034
],
@@ -57,6 +61,14 @@
5761
'yield_from',
5862
],
5963
],
64+
'blank_lines_before_namespace' => [
65+
'max_line_breaks' => 1,
66+
'min_line_breaks' => 0,
67+
],
68+
'braces_position' => [
69+
'anonymous_classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
70+
'anonymous_functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
71+
],
6072
'cast_spaces' => true,
6173
'class_attributes_separation' => [
6274
'elements' => [
@@ -70,15 +82,11 @@
7082
'combine_consecutive_issets' => true,
7183
'combine_consecutive_unsets' => true,
7284
'combine_nested_dirname' => true,
73-
'compact_nullable_typehint' => true,
85+
'compact_nullable_type_declaration' => true,
7486
'concat_space' => ['spacing' => 'one'],
7587
'constant_case' => true,
7688
'control_structure_braces' => true,
7789
'control_structure_continuation_position' => true,
78-
'curly_braces_position' => [
79-
'anonymous_functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
80-
'anonymous_classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
81-
],
8290
'declare_equal_normalize' => ['space' => 'none'],
8391
'declare_parentheses' => true,
8492
'declare_strict_types' => true,
@@ -94,7 +102,6 @@
94102
'fully_qualified_strict_types' => true,
95103
'function_declaration' => true,
96104
'function_to_constant' => true,
97-
'function_typehint_space' => true,
98105
'get_class_to_class_keyword' => true,
99106
'global_namespace_import' => [
100107
'import_classes' => true,
@@ -106,9 +113,10 @@
106113
'implode_call' => true,
107114
'include' => true,
108115
'increment_style' => [
109-
'style' => PhpCsFixer\Fixer\Operator\IncrementStyleFixer::STYLE_POST,
116+
'style' => 'post',
110117
],
111118
'indentation_type' => true,
119+
'integer_literal_case' => true,
112120
'is_null' => true,
113121
'lambda_not_used_import' => true,
114122
'line_ending' => true,
@@ -122,6 +130,8 @@
122130
'method_argument_space' => [
123131
'on_multiline' => 'ensure_fully_multiline',
124132
],
133+
'method_chaining_indentation' => true,
134+
'modernize_strpos' => true,
125135
'modernize_types_casting' => true,
126136
'multiline_comment_opening_closing' => true,
127137
'multiline_whitespace_before_semicolons' => true,
@@ -132,18 +142,17 @@
132142
'@internal',
133143
],
134144
],
135-
'native_function_type_declaration_casing' => true,
136-
'new_with_braces' => [
137-
'named_class' => false,
145+
'native_type_declaration_casing' => true,
146+
'new_with_parentheses' => [
138147
'anonymous_class' => false,
148+
'named_class' => false,
139149
],
140150
'no_alias_functions' => true,
141151
'no_alias_language_construct_call' => true,
142152
'no_alternative_syntax' => true,
143153
'no_binary_string' => true,
144154
'no_blank_lines_after_class_opening' => true,
145155
'no_blank_lines_after_phpdoc' => true,
146-
'no_blank_lines_before_namespace' => true,
147156
'no_break_comment' => true,
148157
'no_closing_tag' => true,
149158
'no_empty_comment' => true,
@@ -154,15 +163,15 @@
154163
'no_leading_import_slash' => true,
155164
'no_leading_namespace_whitespace' => true,
156165
'no_mixed_echo_print' => ['use' => 'print'],
157-
'no_multiple_statements_per_line' => true,
158166
'no_multiline_whitespace_around_double_arrow' => true,
167+
'no_multiple_statements_per_line' => true,
159168
'no_null_property_initialization' => true,
160169
'no_php4_constructor' => true,
161170
'no_short_bool_cast' => true,
162171
'no_singleline_whitespace_before_semicolons' => true,
172+
'no_space_around_double_colon' => true,
163173
'no_spaces_after_function_name' => true,
164174
'no_spaces_around_offset' => true,
165-
'no_spaces_inside_parenthesis' => true,
166175
'no_superfluous_elseif' => true,
167176
'no_superfluous_phpdoc_tags' => [
168177
'allow_mixed' => true,
@@ -171,22 +180,25 @@
171180
'no_trailing_whitespace' => true,
172181
'no_trailing_whitespace_in_comment' => true,
173182
'no_trailing_whitespace_in_string' => true,
183+
'no_unneeded_braces' => true,
174184
'no_unneeded_control_parentheses' => true,
175-
'no_unneeded_curly_braces' => true,
176185
'no_unneeded_final_method' => true,
177186
'no_unneeded_import_alias' => true,
178187
'no_unreachable_default_argument_value' => true,
179188
'no_unset_cast' => true,
180189
'no_unset_on_property' => true,
181190
'no_unused_imports' => true,
191+
'no_useless_concat_operator' => true,
182192
'no_useless_else' => true,
193+
'no_useless_nullsafe_operator' => true,
183194
'no_useless_return' => true,
184195
'no_useless_sprintf' => true,
185196
'no_whitespace_before_comma_in_array' => true,
186197
'no_whitespace_in_blank_line' => true,
187198
'non_printable_character' => true,
188199
'normalize_index_brace' => true,
189200
'object_operator_without_whitespace' => true,
201+
'octal_notation' => true,
190202
'operator_linebreak' => [
191203
'only_booleans' => true,
192204
'position' => 'end',
@@ -217,16 +229,17 @@
217229
],
218230
'ordered_imports' => [
219231
'imports_order' => [
220-
PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CONST,
221-
PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_FUNCTION,
222-
PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CLASS,
232+
'const',
233+
'function',
234+
'class',
223235
]
224236
],
225237
'ordered_interfaces' => [
226238
'direction' => 'ascend',
227239
'order' => 'alpha',
228240
],
229241
'ordered_traits' => true,
242+
'ordered_types' => true,
230243
'php_unit_set_up_tear_down_visibility' => true,
231244
'php_unit_test_case_static_method_calls' => [
232245
'call_type' => 'this',
@@ -250,14 +263,15 @@
250263
'uses',
251264
],
252265
],
266+
'phpdoc_param_order' => true,
253267
'phpdoc_return_self_reference' => true,
254268
'phpdoc_scalar' => true,
255269
'phpdoc_separation' => true,
256270
'phpdoc_single_line_var_spacing' => true,
257271
'phpdoc_summary' => true,
258272
'phpdoc_tag_casing' => true,
259273
'phpdoc_tag_type' => true,
260-
'phpdoc_to_comment' => true,
274+
'phpdoc_to_comment' => false,
261275
'phpdoc_trim' => true,
262276
'phpdoc_trim_consecutive_blank_line_separation' => true,
263277
'phpdoc_types' => ['groups' => ['simple', 'meta']],
@@ -279,15 +293,20 @@
279293
'single_class_element_per_statement' => true,
280294
'single_import_per_statement' => true,
281295
'single_line_after_imports' => true,
296+
'single_line_comment_spacing' => true,
282297
'single_quote' => true,
283298
'single_space_around_construct' => true,
284299
'single_trait_insert_per_statement' => true,
285300
'space_after_semicolon' => true,
301+
'spaces_inside_parentheses' => [
302+
'space' => 'none',
303+
],
286304
'standardize_increment' => true,
287305
'standardize_not_equals' => true,
288306
'statement_indentation' => true,
289307
'static_lambda' => true,
290308
'strict_param' => true,
309+
'string_length_to_empty'=> true,
291310
'string_line_ending' => true,
292311
'switch_case_semicolon_to_colon' => true,
293312
'switch_case_space' => true,
@@ -297,13 +316,18 @@
297316
'ternary_to_null_coalescing' => true,
298317
'trailing_comma_in_multiline' => [
299318
'elements' => [
300-
'arrays'
319+
'arguments',
320+
'arrays',
321+
'match',
301322
]
302323
],
303324
'trim_array_spaces' => true,
304-
'types_spaces' => [
305-
'space' => 'none',
325+
'type_declaration_spaces' => [
326+
'elements' => [
327+
'function',
328+
],
306329
],
330+
'types_spaces' => true,
307331
'unary_operator_spaces' => true,
308332
'visibility_required' => [
309333
'elements' => [
@@ -316,4 +340,6 @@
316340
'whitespace_after_comma_in_array' => true,
317341
]);
318342

343+
$config->setCacheFile(__DIR__ . '/.php-cs-fixer.cache/' . sha1(@trim((string) @shell_exec('git rev-parse --abbrev-ref HEAD'))));
344+
319345
return $config;

0 commit comments

Comments
 (0)