|
13 | 13 | ->in(__DIR__ . '/src')
|
14 | 14 | ->in(__DIR__ . '/tests/unit');
|
15 | 15 |
|
16 |
| -return PhpCsFixer\Config::create() |
17 |
| - ->setFinder($finder) |
| 16 | +$config = new PhpCsFixer\Config; |
| 17 | +$config->setFinder($finder) |
18 | 18 | ->setRiskyAllowed(true)
|
19 | 19 | ->setRules([
|
20 | 20 | 'align_multiline_comment' => true,
|
21 | 21 | 'array_indentation' => true,
|
| 22 | + 'array_push' => true, |
22 | 23 | 'array_syntax' => ['syntax' => 'short'],
|
| 24 | + 'backtick_to_shell_exec' => true, |
23 | 25 | 'binary_operator_spaces' => [
|
24 | 26 | 'operators' => [
|
25 | 27 | '=' => 'align_single_space_minimal',
|
26 | 28 | '=>' => 'align_single_space_minimal',
|
| 29 | + // Workaround for https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/5495 |
| 30 | + '|' => null, |
27 | 31 | ],
|
28 | 32 | ],
|
29 | 33 | 'blank_line_after_namespace' => true,
|
|
33 | 37 | 'continue',
|
34 | 38 | 'declare',
|
35 | 39 | 'default',
|
36 |
| - 'die', |
37 | 40 | 'do',
|
38 | 41 | 'exit',
|
39 | 42 | 'for',
|
|
54 | 57 | ],
|
55 | 58 | 'braces' => true,
|
56 | 59 | 'cast_spaces' => true,
|
57 |
| - 'class_attributes_separation' => ['elements' => ['const', 'method', 'property']], |
| 60 | + 'class_attributes_separation' => [ |
| 61 | + 'elements' => [ |
| 62 | + 'const' => 'one', |
| 63 | + 'method' => 'one', |
| 64 | + 'property' => 'one' |
| 65 | + ] |
| 66 | + ], |
| 67 | + 'class_definition' => true, |
| 68 | + 'clean_namespace' => true, |
58 | 69 | 'combine_consecutive_issets' => true,
|
59 | 70 | 'combine_consecutive_unsets' => true,
|
| 71 | + 'combine_nested_dirname' => true, |
60 | 72 | 'compact_nullable_typehint' => true,
|
61 | 73 | 'concat_space' => ['spacing' => 'one'],
|
62 | 74 | 'constant_case' => true,
|
63 | 75 | 'declare_equal_normalize' => ['space' => 'none'],
|
64 | 76 | 'declare_strict_types' => true,
|
65 | 77 | 'dir_constant' => true,
|
| 78 | + 'echo_tag_syntax' => true, |
66 | 79 | 'elseif' => true,
|
67 | 80 | 'encoding' => true,
|
| 81 | + 'ereg_to_preg' => true, |
68 | 82 | 'explicit_indirect_variable' => true,
|
69 | 83 | 'explicit_string_variable' => true,
|
| 84 | + 'fopen_flag_order' => true, |
70 | 85 | 'full_opening_tag' => true,
|
71 | 86 | 'fully_qualified_strict_types' => true,
|
72 | 87 | 'function_declaration' => true,
|
| 88 | + 'function_to_constant' => true, |
| 89 | + 'function_typehint_space' => true, |
73 | 90 | 'global_namespace_import' => [
|
74 | 91 | 'import_classes' => true,
|
75 | 92 | 'import_constants' => true,
|
76 | 93 | 'import_functions' => true,
|
77 | 94 | ],
|
78 | 95 | 'header_comment' => ['header' => $header, 'separate' => 'none'],
|
79 | 96 | 'heredoc_to_nowdoc' => true,
|
| 97 | + 'implode_call' => true, |
| 98 | + 'include' => true, |
80 | 99 | 'increment_style' => [
|
81 | 100 | 'style' => PhpCsFixer\Fixer\Operator\IncrementStyleFixer::STYLE_POST,
|
82 | 101 | ],
|
83 | 102 | 'indentation_type' => true,
|
84 | 103 | 'is_null' => true,
|
| 104 | + 'lambda_not_used_import' => true, |
85 | 105 | 'line_ending' => true,
|
86 | 106 | 'list_syntax' => ['syntax' => 'short'],
|
87 | 107 | 'logical_operators' => true,
|
| 108 | + 'lowercase_cast' => true, |
88 | 109 | 'lowercase_keywords' => true,
|
89 | 110 | 'lowercase_static_reference' => true,
|
90 | 111 | 'magic_constant_casing' => true,
|
91 | 112 | 'magic_method_casing' => true,
|
92 |
| - 'method_argument_space' => ['ensure_fully_multiline' => true], |
| 113 | + 'method_argument_space' => [ |
| 114 | + 'on_multiline' => 'ensure_fully_multiline', |
| 115 | + ], |
93 | 116 | 'modernize_types_casting' => true,
|
94 | 117 | 'multiline_comment_opening_closing' => true,
|
95 | 118 | 'multiline_whitespace_before_semicolons' => true,
|
|
99 | 122 | 'native_function_type_declaration_casing' => true,
|
100 | 123 | 'new_with_braces' => false,
|
101 | 124 | 'no_alias_functions' => true,
|
| 125 | + 'no_alias_language_construct_call' => true, |
102 | 126 | 'no_alternative_syntax' => true,
|
| 127 | + 'no_binary_string' => true, |
103 | 128 | 'no_blank_lines_after_class_opening' => true,
|
104 | 129 | 'no_blank_lines_after_phpdoc' => true,
|
105 | 130 | 'no_blank_lines_before_namespace' => true,
|
| 131 | + 'no_break_comment' => true, |
106 | 132 | 'no_closing_tag' => true,
|
107 | 133 | 'no_empty_comment' => true,
|
108 | 134 | 'no_empty_phpdoc' => true,
|
|
116 | 142 | 'no_null_property_initialization' => true,
|
117 | 143 | 'no_php4_constructor' => true,
|
118 | 144 | 'no_short_bool_cast' => true,
|
119 |
| - 'no_short_echo_tag' => true, |
120 | 145 | 'no_singleline_whitespace_before_semicolons' => true,
|
121 | 146 | 'no_spaces_after_function_name' => true,
|
122 | 147 | 'no_spaces_around_offset' => true,
|
|
129 | 154 | 'no_trailing_comma_in_singleline_array' => true,
|
130 | 155 | 'no_trailing_whitespace' => true,
|
131 | 156 | 'no_trailing_whitespace_in_comment' => true,
|
| 157 | + 'no_trailing_whitespace_in_string' => true, |
132 | 158 | 'no_unneeded_control_parentheses' => true,
|
133 | 159 | 'no_unneeded_curly_braces' => true,
|
134 | 160 | 'no_unneeded_final_method' => true,
|
135 | 161 | 'no_unreachable_default_argument_value' => true,
|
| 162 | + 'no_unset_cast' => true, |
136 | 163 | 'no_unset_on_property' => true,
|
137 | 164 | 'no_unused_imports' => true,
|
138 | 165 | 'no_useless_else' => true,
|
139 | 166 | 'no_useless_return' => true,
|
| 167 | + 'no_useless_sprintf' => true, |
140 | 168 | 'no_whitespace_before_comma_in_array' => true,
|
141 | 169 | 'no_whitespace_in_blank_line' => true,
|
142 | 170 | 'non_printable_character' => true,
|
143 | 171 | 'normalize_index_brace' => true,
|
144 | 172 | 'object_operator_without_whitespace' => true,
|
| 173 | + 'operator_linebreak' => [ |
| 174 | + 'only_booleans' => true, |
| 175 | + 'position' => 'end', |
| 176 | + ], |
145 | 177 | 'ordered_class_elements' => [
|
146 | 178 | 'order' => [
|
147 | 179 | 'use_trait',
|
|
177 | 209 | 'direction' => 'ascend',
|
178 | 210 | 'order' => 'alpha',
|
179 | 211 | ],
|
| 212 | + 'ordered_traits' => true, |
| 213 | + 'php_unit_set_up_tear_down_visibility' => true, |
| 214 | + 'php_unit_test_case_static_method_calls' => [ |
| 215 | + 'call_type' => 'this', |
| 216 | + ], |
180 | 217 | 'phpdoc_add_missing_param_annotation' => false,
|
181 | 218 | 'phpdoc_align' => true,
|
182 | 219 | 'phpdoc_annotation_without_dot' => true,
|
183 | 220 | 'phpdoc_indent' => true,
|
| 221 | + 'phpdoc_inline_tag_normalizer' => true, |
184 | 222 | 'phpdoc_no_access' => true,
|
| 223 | + 'phpdoc_no_alias_tag' => true, |
185 | 224 | 'phpdoc_no_empty_return' => true,
|
186 | 225 | 'phpdoc_no_package' => true,
|
| 226 | + 'phpdoc_no_useless_inheritdoc' => true, |
187 | 227 | 'phpdoc_order' => true,
|
| 228 | + 'phpdoc_order_by_value' => [ |
| 229 | + 'annotations' => [ |
| 230 | + 'covers', |
| 231 | + 'dataProvider', |
| 232 | + 'throws', |
| 233 | + 'uses', |
| 234 | + ], |
| 235 | + ], |
188 | 236 | 'phpdoc_return_self_reference' => true,
|
189 | 237 | 'phpdoc_scalar' => true,
|
190 | 238 | 'phpdoc_separation' => true,
|
191 | 239 | 'phpdoc_single_line_var_spacing' => true,
|
192 | 240 | 'phpdoc_summary' => true,
|
| 241 | + 'phpdoc_tag_casing' => true, |
| 242 | + 'phpdoc_tag_type' => true, |
193 | 243 | 'phpdoc_to_comment' => true,
|
194 | 244 | 'phpdoc_trim' => true,
|
195 | 245 | 'phpdoc_trim_consecutive_blank_line_separation' => true,
|
196 | 246 | 'phpdoc_types' => ['groups' => ['simple', 'meta']],
|
197 | 247 | 'phpdoc_types_order' => true,
|
| 248 | + 'phpdoc_var_annotation_correct_order' => true, |
198 | 249 | 'phpdoc_var_without_name' => true,
|
199 | 250 | 'pow_to_exponentiation' => true,
|
200 | 251 | 'protected_to_private' => true,
|
|
208 | 259 | 'simple_to_complex_string_variable' => true,
|
209 | 260 | 'simplified_null_return' => false,
|
210 | 261 | 'single_blank_line_at_eof' => true,
|
| 262 | + 'single_class_element_per_statement' => true, |
211 | 263 | 'single_import_per_statement' => true,
|
212 | 264 | 'single_line_after_imports' => true,
|
213 | 265 | 'single_quote' => true,
|
| 266 | + 'single_space_after_construct' => true, |
| 267 | + 'single_trait_insert_per_statement' => true, |
| 268 | + 'space_after_semicolon' => true, |
| 269 | + 'standardize_increment' => true, |
214 | 270 | 'standardize_not_equals' => true,
|
| 271 | + 'static_lambda' => true, |
215 | 272 | 'strict_param' => true,
|
| 273 | + 'string_line_ending' => true, |
| 274 | + 'switch_case_semicolon_to_colon' => true, |
| 275 | + 'switch_case_space' => true, |
| 276 | + 'switch_continue_to_break' => true, |
| 277 | + 'ternary_operator_spaces' => true, |
| 278 | + 'ternary_to_elvis_operator' => true, |
216 | 279 | 'ternary_to_null_coalescing' => true,
|
217 |
| - 'trailing_comma_in_multiline_array' => true, |
| 280 | + 'trailing_comma_in_multiline' => [ |
| 281 | + 'elements' => [ |
| 282 | + 'arrays' |
| 283 | + ] |
| 284 | + ], |
218 | 285 | 'trim_array_spaces' => true,
|
219 | 286 | 'unary_operator_spaces' => true,
|
220 | 287 | 'visibility_required' => [
|
|
227 | 294 | 'void_return' => true,
|
228 | 295 | 'whitespace_after_comma_in_array' => true,
|
229 | 296 | ]);
|
| 297 | + |
| 298 | +return $config; |
0 commit comments