|
6 | 6 | ->exclude([ |
7 | 7 | '.build/', |
8 | 8 | '.github/', |
| 9 | + 'test/', |
9 | 10 | 'vendor-bin/', |
10 | 11 | ]) |
11 | | - ->notPath([ |
12 | | - 'test/Fixture/Enum/BackedEnum.php', |
13 | | - ]) |
14 | 12 | ->ignoreDotFiles(false) |
15 | 13 | ->in(__DIR__); |
16 | 14 |
|
|
20 | 18 | mkdir('.build/php-cs-fixer', 0755, true); |
21 | 19 | } |
22 | 20 |
|
| 21 | +$rules = require __DIR__ . '/.php-cs-fixer.rules.php'; |
| 22 | + |
23 | 23 | return $config |
24 | 24 | ->setCacheFile('.build/php-cs-fixer/cache') |
25 | 25 | ->setFinder($finder) |
26 | 26 | ->setRiskyAllowed(true) |
27 | | - ->setRules([ |
28 | | - '@PSR2' => true, |
29 | | - 'array_indentation' => true, |
30 | | - 'array_syntax' => [ |
31 | | - 'syntax' => 'short', |
32 | | - ], |
33 | | - 'binary_operator_spaces' => true, |
34 | | - 'blank_line_after_opening_tag' => true, |
35 | | - 'blank_line_before_statement' => [ |
36 | | - 'statements' => [ |
37 | | - 'break', |
38 | | - 'continue', |
39 | | - 'default', |
40 | | - 'do', |
41 | | - 'exit', |
42 | | - 'for', |
43 | | - 'foreach', |
44 | | - 'if', |
45 | | - 'include', |
46 | | - 'include_once', |
47 | | - 'require', |
48 | | - 'require_once', |
49 | | - 'return', |
50 | | - 'switch', |
51 | | - 'throw', |
52 | | - 'try', |
53 | | - 'while', |
54 | | - 'yield', |
55 | | - ], |
56 | | - ], |
57 | | - 'blank_lines_before_namespace' => [ |
58 | | - 'max_line_breaks' => 2, |
59 | | - 'min_line_breaks' => 2, |
60 | | - ], |
61 | | - 'cast_spaces' => true, |
62 | | - 'class_attributes_separation' => [ |
63 | | - 'elements' => [ |
64 | | - 'method' => 'one', |
65 | | - ], |
66 | | - ], |
67 | | - 'combine_nested_dirname' => true, |
68 | | - 'compact_nullable_typehint' => true, |
69 | | - 'concat_space' => [ |
70 | | - 'spacing' => 'one', |
71 | | - ], |
72 | | - 'control_structure_braces' => true, |
73 | | - 'control_structure_continuation_position' => true, |
74 | | - 'curly_braces_position' => true, |
75 | | - 'declare_equal_normalize' => true, |
76 | | - 'declare_parentheses' => true, |
77 | | - 'general_phpdoc_annotation_remove' => [ |
78 | | - 'annotations' => [ |
79 | | - 'author', |
80 | | - ], |
81 | | - ], |
82 | | - 'global_namespace_import' => [ |
83 | | - 'import_classes' => false, |
84 | | - 'import_constants' => false, |
85 | | - 'import_functions' => false, |
86 | | - ], |
87 | | - 'implode_call' => true, |
88 | | - 'increment_style' => true, |
89 | | - 'is_null' => true, |
90 | | - 'lambda_not_used_import' => true, |
91 | | - 'list_syntax' => [ |
92 | | - 'syntax' => 'short', |
93 | | - ], |
94 | | - 'lowercase_cast' => true, |
95 | | - 'lowercase_static_reference' => true, |
96 | | - 'magic_constant_casing' => true, |
97 | | - 'magic_method_casing' => true, |
98 | | - 'modernize_types_casting' => true, |
99 | | - 'multiline_comment_opening_closing' => true, |
100 | | - 'new_with_braces' => true, |
101 | | - 'no_alias_functions' => true, |
102 | | - 'no_blank_lines_after_class_opening' => true, |
103 | | - 'no_blank_lines_after_phpdoc' => true, |
104 | | - 'no_empty_phpdoc' => true, |
105 | | - 'no_empty_statement' => true, |
106 | | - 'no_extra_blank_lines' => true, |
107 | | - 'no_leading_import_slash' => true, |
108 | | - 'no_leading_namespace_whitespace' => true, |
109 | | - 'no_multiple_statements_per_line' => true, |
110 | | - 'no_spaces_around_offset' => true, |
111 | | - 'no_superfluous_elseif' => true, |
112 | | - 'no_superfluous_phpdoc_tags' => true, |
113 | | - 'no_trailing_comma_in_singleline' => [ |
114 | | - 'elements' => [ |
115 | | - 'array', |
116 | | - ], |
117 | | - ], |
118 | | - 'no_unneeded_control_parentheses' => true, |
119 | | - 'no_unneeded_curly_braces' => true, |
120 | | - 'no_unneeded_final_method' => true, |
121 | | - 'no_unreachable_default_argument_value' => true, |
122 | | - 'no_unset_cast' => true, |
123 | | - 'no_unused_imports' => true, |
124 | | - 'no_useless_else' => true, |
125 | | - 'no_whitespace_before_comma_in_array' => true, |
126 | | - 'no_whitespace_in_blank_line' => true, |
127 | | - 'non_printable_character' => true, |
128 | | - 'normalize_index_brace' => true, |
129 | | - 'operator_linebreak' => [ |
130 | | - 'only_booleans' => true, |
131 | | - 'position' => 'beginning', |
132 | | - ], |
133 | | - 'ordered_imports' => true, |
134 | | - 'php_unit_construct' => true, |
135 | | - 'php_unit_dedicate_assert' => true, |
136 | | - 'php_unit_dedicate_assert_internal_type' => true, |
137 | | - 'php_unit_expectation' => true, |
138 | | - 'php_unit_fqcn_annotation' => true, |
139 | | - 'php_unit_method_casing' => true, |
140 | | - 'php_unit_mock' => true, |
141 | | - 'php_unit_mock_short_will_return' => true, |
142 | | - 'php_unit_namespaced' => true, |
143 | | - 'php_unit_no_expectation_annotation' => true, |
144 | | - 'php_unit_set_up_tear_down_visibility' => true, |
145 | | - 'php_unit_test_case_static_method_calls' => [ |
146 | | - 'call_type' => 'self', |
147 | | - ], |
148 | | - 'phpdoc_align' => true, |
149 | | - 'phpdoc_indent' => true, |
150 | | - 'phpdoc_inline_tag_normalizer' => true, |
151 | | - 'phpdoc_line_span' => true, |
152 | | - 'phpdoc_no_access' => true, |
153 | | - 'phpdoc_no_alias_tag' => [ |
154 | | - 'replacements' => [ |
155 | | - 'link' => 'see', |
156 | | - 'type' => 'var', |
157 | | - ], |
158 | | - ], |
159 | | - 'phpdoc_no_empty_return' => true, |
160 | | - 'phpdoc_no_package' => true, |
161 | | - 'phpdoc_order' => true, |
162 | | - 'phpdoc_order_by_value' => [ |
163 | | - 'annotations' => [ |
164 | | - 'covers', |
165 | | - 'dataProvider', |
166 | | - 'group', |
167 | | - 'requires', |
168 | | - 'throws', |
169 | | - 'uses', |
170 | | - ], |
171 | | - ], |
172 | | - 'phpdoc_return_self_reference' => true, |
173 | | - 'phpdoc_scalar' => true, |
174 | | - 'phpdoc_separation' => true, |
175 | | - 'phpdoc_single_line_var_spacing' => true, |
176 | | - 'phpdoc_trim' => true, |
177 | | - 'phpdoc_trim_consecutive_blank_line_separation' => true, |
178 | | - 'phpdoc_types' => true, |
179 | | - 'phpdoc_types_order' => [ |
180 | | - 'null_adjustment' => 'always_last', |
181 | | - 'sort_algorithm' => 'alpha', |
182 | | - ], |
183 | | - 'phpdoc_var_without_name' => true, |
184 | | - 'pow_to_exponentiation' => true, |
185 | | - 'protected_to_private' => true, |
186 | | - 'psr_autoloading' => true, |
187 | | - 'random_api_migration' => true, |
188 | | - 'return_assignment' => true, |
189 | | - 'return_type_declaration' => true, |
190 | | - 'self_static_accessor' => true, |
191 | | - 'semicolon_after_instruction' => true, |
192 | | - 'short_scalar_cast' => true, |
193 | | - 'single_line_comment_style' => true, |
194 | | - 'single_quote' => true, |
195 | | - 'single_space_around_construct' => [ |
196 | | - 'constructs_contain_a_single_space' => [], |
197 | | - 'constructs_followed_by_a_single_space' => [ |
198 | | - 'elseif', |
199 | | - 'for', |
200 | | - 'foreach', |
201 | | - 'if', |
202 | | - 'match', |
203 | | - 'while', |
204 | | - 'use_lambda', |
205 | | - ], |
206 | | - 'constructs_preceded_by_a_single_space' => [ |
207 | | - 'use_lambda', |
208 | | - ], |
209 | | - ], |
210 | | - 'single_trait_insert_per_statement' => true, |
211 | | - 'standardize_not_equals' => true, |
212 | | - 'statement_indentation' => true, |
213 | | - 'static_lambda' => true, |
214 | | - 'strict_param' => true, |
215 | | - 'switch_case_space' => true, |
216 | | - 'ternary_operator_spaces' => true, |
217 | | - 'ternary_to_null_coalescing' => true, |
218 | | - 'trailing_comma_in_multiline' => [ |
219 | | - 'elements' => [ |
220 | | - 'arguments', |
221 | | - 'arrays', |
222 | | - ], |
223 | | - ], |
224 | | - 'trim_array_spaces' => true, |
225 | | - 'type_declaration_spaces' => [ |
226 | | - 'elements' => [ |
227 | | - 'function', |
228 | | - ], |
229 | | - ], |
230 | | - 'unary_operator_spaces' => true, |
231 | | - 'visibility_required' => [ |
232 | | - 'elements' => [ |
233 | | - 'const', |
234 | | - 'method', |
235 | | - 'property', |
236 | | - ], |
237 | | - ], |
238 | | - 'void_return' => false, |
239 | | - 'whitespace_after_comma_in_array' => true, |
240 | | - ]); |
| 27 | + ->setRules($rules); |
0 commit comments