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