|
11 | 11 | * @see https://github.com/guanguans/soar-php |
12 | 12 | */ |
13 | 13 |
|
14 | | -use AdamWojs\PhpCsFixerPhpdocForceFQCN\Fixer\Phpdoc\ForceFQCNFixer; |
15 | 14 | use Ergebnis\License\Holder; |
16 | 15 | use Ergebnis\License\Range; |
17 | 16 | use Ergebnis\License\Type\MIT; |
|
22 | 21 | use Ergebnis\PhpCsFixer\Config\Rules; |
23 | 22 | use Ergebnis\PhpCsFixer\Config\RuleSet\Php81; |
24 | 23 | use PhpCsFixer\Finder; |
25 | | -use PhpCsFixer\Fixer\DeprecatedFixerInterface; |
26 | | -use PhpCsFixer\Fixer\FixerInterface; |
27 | 24 |
|
28 | 25 | require __DIR__.'/vendor/autoload.php'; |
29 | 26 |
|
30 | | -// putenv('PHP_CS_FIXER_ENFORCE_CACHE=1'); |
31 | | -// putenv('PHP_CS_FIXER_IGNORE_ENV=1'); |
32 | | -putenv('PHP_CS_FIXER_FUTURE_MODE=1'); |
33 | | -putenv('PHP_CS_FIXER_NON_MONOLITHIC=1'); |
34 | | -putenv('PHP_CS_FIXER_PARALLEL=1'); |
35 | | - |
36 | 27 | return Factory::fromRuleSet(Php81::create() |
37 | 28 | ->withHeader( |
38 | 29 | (static function (): string { |
|
51 | 42 | return $mit->header(); |
52 | 43 | })() |
53 | 44 | ) |
54 | | - ->withCustomFixers(Fixers::fromFixers($forceFQCNFixer = new ForceFQCNFixer)) |
55 | | - ->withRules(Rules::fromArray([ |
56 | | - $forceFQCNFixer->getName() => true, |
57 | | - ])) |
58 | | - ->withCustomFixers(Fixers::fromFixers(...$erickSkrauchFixers = array_filter( |
59 | | - iterator_to_array(new ErickSkrauch\PhpCsFixer\Fixers), |
60 | | - static fn (FixerInterface $fixer): bool => !$fixer instanceof DeprecatedFixerInterface |
61 | | - && !\array_key_exists($fixer->getName(), Php81::create()->rules()->toArray()) |
62 | | - && !\in_array( |
63 | | - $fixer->getName(), |
64 | | - [ |
65 | | - 'ErickSkrauch/align_multiline_parameters', |
66 | | - 'ErickSkrauch/blank_line_around_class_body', |
67 | | - ], |
68 | | - true |
69 | | - ) |
70 | | - ))) |
71 | | - ->withRules(Rules::fromArray(array_reduce( |
72 | | - $erickSkrauchFixers, |
73 | | - static function (array $carry, FixerInterface $fixer): array { |
74 | | - $carry[$fixer->getName()] = true; |
75 | | - |
76 | | - return $carry; |
77 | | - }, |
78 | | - [] |
79 | | - ))) |
80 | | - ->withCustomFixers(Fixers::fromFixers(...$phpCsFixerCustomFixers = array_filter( |
81 | | - iterator_to_array(new PhpCsFixerCustomFixers\Fixers), |
82 | | - static fn (FixerInterface $fixer): bool => !$fixer instanceof DeprecatedFixerInterface |
83 | | - && !\array_key_exists($fixer->getName(), Php81::create()->rules()->toArray()) |
84 | | - && !\in_array( |
85 | | - $fixer->getName(), |
86 | | - [ |
87 | | - 'PhpCsFixerCustomFixers/declare_after_opening_tag', |
88 | | - 'PhpCsFixerCustomFixers/isset_to_array_key_exists', |
89 | | - 'PhpCsFixerCustomFixers/no_commented_out_code', |
90 | | - // 'PhpCsFixerCustomFixers/no_leading_slash_in_global_namespace', |
91 | | - 'PhpCsFixerCustomFixers/no_nullable_boolean_type', |
92 | | - 'PhpCsFixerCustomFixers/phpdoc_only_allowed_annotations', |
93 | | - 'PhpCsFixerCustomFixers/typed_class_constant', // @since 8.3 |
94 | | - ], |
95 | | - true |
96 | | - ) |
97 | | - ))) |
98 | | - ->withRules(Rules::fromArray(array_reduce( |
99 | | - $phpCsFixerCustomFixers, |
100 | | - static function (array $carry, FixerInterface $fixer): array { |
101 | | - $carry[$fixer->getName()] = true; |
102 | | - |
103 | | - return $carry; |
104 | | - }, |
105 | | - [] |
106 | | - ))) |
107 | | - ->withRules(Rules::fromArray([ |
108 | | - // '@auto' => true, |
109 | | - // '@auto:risky' => true, |
110 | | - // '@autoPHPMigration' => true, |
111 | | - // '@autoPHPMigration:risky' => true, |
112 | | - // '@autoPHPUnitMigration:risky' => true, |
113 | | - // '@DoctrineAnnotation' => true, |
114 | | - // '@PHP7x4Migration' => true, |
115 | | - // '@PHP7x4Migration:risky' => true, |
116 | | - // '@PHP8x0Migration' => true, |
117 | | - // '@PHP8x0Migration:risky' => true, |
118 | | - '@PHP8x1Migration' => true, |
119 | | - // '@PHP8x1Migration:risky' => true, |
120 | | - // '@PHP8x2Migration' => true, |
121 | | - // '@PHP8x2Migration:risky' => true, |
122 | | - // '@PHP8x3Migration' => true, |
123 | | - // '@PHP8x3Migration:risky' => true, |
124 | | - // '@PHP8x4Migration' => true, |
125 | | - // '@PHP8x4Migration:risky' => true, |
126 | | - // '@PHP8x5Migration' => true, |
127 | | - // '@PHP8x5Migration:risky' => true, |
128 | | - // '@PhpCsFixer' => true, |
129 | | - // '@PhpCsFixer:risky' => true, |
130 | | - // '@PHPUnit8x4Migration:risky' => true, |
131 | | - // '@PHPUnit9x1Migration:risky' => true, |
132 | | - '@PHPUnit10x0Migration:risky' => true, |
133 | | - ])) |
| 45 | + ->withCustomFixers(Fixers::fromFixers(... require __DIR__.'/vendor/guanguans/php-cs-fixer-custom-fixers/config/custom-fixers.php')) |
| 46 | + ->withRules(Rules::fromArray(require __DIR__.'/vendor/guanguans/php-cs-fixer-custom-fixers/config/custom-rules.php')) |
| 47 | + ->withRules(Rules::fromArray(require __DIR__.'/vendor/guanguans/php-cs-fixer-custom-fixers/config/rules.php')) |
134 | 48 | ->withRules(Rules::fromArray([ |
135 | | - 'align_multiline_comment' => [ |
136 | | - 'comment_type' => 'phpdocs_only', |
137 | | - ], |
138 | | - 'attribute_empty_parentheses' => [ |
139 | | - 'use_parentheses' => false, |
140 | | - ], |
141 | | - 'blank_line_before_statement' => [ |
142 | | - 'statements' => [ |
143 | | - 'break', |
144 | | - // 'case', |
145 | | - 'continue', |
146 | | - 'declare', |
147 | | - // 'default', |
148 | | - 'do', |
149 | | - 'exit', |
150 | | - 'for', |
151 | | - 'foreach', |
152 | | - 'goto', |
153 | | - 'if', |
154 | | - 'include', |
155 | | - 'include_once', |
156 | | - 'phpdoc', |
157 | | - 'require', |
158 | | - 'require_once', |
159 | | - 'return', |
160 | | - 'switch', |
161 | | - 'throw', |
162 | | - 'try', |
163 | | - 'while', |
164 | | - 'yield', |
165 | | - 'yield_from', |
166 | | - ], |
167 | | - ], |
168 | | - 'class_definition' => [ |
169 | | - 'inline_constructor_arguments' => false, |
170 | | - 'multi_line_extends_each_single_line' => false, |
171 | | - 'single_item_single_line' => false, |
172 | | - 'single_line' => false, |
173 | | - 'space_before_parenthesis' => false, |
174 | | - ], |
175 | | - 'concat_space' => [ |
176 | | - 'spacing' => 'none', |
177 | | - ], |
178 | | - 'empty_loop_condition' => [ |
179 | | - 'style' => 'for', |
180 | | - ], |
181 | | - 'explicit_string_variable' => false, |
182 | | - 'final_class' => false, |
183 | | - // 'final_internal_class' => false, |
184 | | - // 'final_public_method_for_abstract_class' => false, |
185 | | - 'fully_qualified_strict_types' => [ |
186 | | - 'import_symbols' => false, |
187 | | - 'leading_backslash_in_global_namespace' => false, |
188 | | - 'phpdoc_tags' => [ |
189 | | - // 'param', |
190 | | - // 'phpstan-param', |
191 | | - // 'phpstan-property', |
192 | | - // 'phpstan-property-read', |
193 | | - // 'phpstan-property-write', |
194 | | - // 'phpstan-return', |
195 | | - // 'phpstan-var', |
196 | | - // 'property', |
197 | | - // 'property-read', |
198 | | - // 'property-write', |
199 | | - // 'psalm-param', |
200 | | - // 'psalm-property', |
201 | | - // 'psalm-property-read', |
202 | | - // 'psalm-property-write', |
203 | | - // 'psalm-return', |
204 | | - // 'psalm-var', |
205 | | - // 'return', |
206 | | - // 'see', |
207 | | - // 'throws', |
208 | | - // 'var', |
209 | | - ], |
210 | | - ], |
211 | | - 'logical_operators' => false, |
212 | | - 'mb_str_functions' => false, |
213 | | - 'native_function_invocation' => [ |
214 | | - 'exclude' => [], |
215 | | - 'include' => ['@compiler_optimized', 'is_scalar'], |
216 | | - 'scope' => 'all', |
217 | | - 'strict' => true, |
218 | | - ], |
219 | | - 'new_with_parentheses' => [ |
220 | | - 'anonymous_class' => false, |
221 | | - 'named_class' => false, |
222 | | - ], |
223 | | - 'no_extra_blank_lines' => [ |
224 | | - 'tokens' => [ |
225 | | - 'attribute', |
226 | | - 'break', |
227 | | - 'case', |
228 | | - // 'comma', |
229 | | - 'continue', |
230 | | - 'curly_brace_block', |
231 | | - 'default', |
232 | | - 'extra', |
233 | | - 'parenthesis_brace_block', |
234 | | - 'return', |
235 | | - 'square_brace_block', |
236 | | - 'switch', |
237 | | - 'throw', |
238 | | - 'use', |
239 | | - ], |
240 | | - ], |
241 | | - 'ordered_traits' => [ |
242 | | - 'case_sensitive' => true, |
243 | | - ], |
244 | | - 'php_unit_data_provider_name' => [ |
245 | | - 'prefix' => 'provide', |
246 | | - 'suffix' => 'Cases', |
247 | | - ], |
248 | | - 'phpdoc_align' => [ |
249 | | - 'align' => 'left', |
250 | | - 'spacing' => 1, |
251 | | - 'tags' => [ |
252 | | - 'method', |
253 | | - 'param', |
254 | | - 'property', |
255 | | - 'property-read', |
256 | | - 'property-write', |
257 | | - 'return', |
258 | | - 'throws', |
259 | | - 'type', |
260 | | - 'var', |
261 | | - ], |
262 | | - ], |
263 | | - 'phpdoc_line_span' => [ |
264 | | - 'const' => 'single', |
265 | | - 'method' => 'multi', |
266 | | - 'property' => 'single', |
267 | | - ], |
268 | | - 'phpdoc_no_alias_tag' => [ |
269 | | - 'replacements' => [ |
270 | | - 'link' => 'see', |
271 | | - // 'property-read' => 'property', |
272 | | - // 'property-write' => 'property', |
273 | | - 'type' => 'var', |
274 | | - ], |
275 | | - ], |
276 | | - 'phpdoc_order' => [ |
277 | | - 'order' => [ |
278 | | - 'noinspection', |
279 | | - 'phan-suppress', |
280 | | - 'phpcsSuppress', |
281 | | - 'phpstan-ignore', |
282 | | - 'psalm-suppress', |
283 | | - |
284 | | - 'deprecated', |
285 | | - 'internal', |
286 | | - 'covers', |
287 | | - 'uses', |
288 | | - 'dataProvider', |
289 | | - 'param', |
290 | | - 'throws', |
291 | | - 'return', |
292 | | - ], |
293 | | - ], |
294 | | - 'phpdoc_order_by_value' => [ |
295 | | - 'annotations' => [ |
296 | | - 'author', |
297 | | - 'covers', |
298 | | - 'coversNothing', |
299 | | - 'dataProvider', |
300 | | - 'depends', |
301 | | - 'group', |
302 | | - 'internal', |
303 | | - // 'method', |
304 | | - 'mixin', |
305 | | - 'property', |
306 | | - 'property-read', |
307 | | - 'property-write', |
308 | | - 'requires', |
309 | | - 'throws', |
310 | | - 'uses', |
311 | | - ], |
312 | | - ], |
313 | | - 'phpdoc_to_param_type' => [ |
314 | | - 'scalar_types' => true, |
315 | | - 'types_map' => [], |
316 | | - 'union_types' => true, |
317 | | - ], |
318 | | - 'phpdoc_to_property_type' => [ |
319 | | - 'scalar_types' => true, |
320 | | - 'types_map' => [], |
321 | | - 'union_types' => true, |
322 | | - ], |
323 | | - 'phpdoc_to_return_type' => [ |
324 | | - 'scalar_types' => true, |
325 | | - 'types_map' => [], |
326 | | - 'union_types' => true, |
327 | | - ], |
328 | | - 'simplified_if_return' => true, |
329 | | - 'simplified_null_return' => true, |
330 | | - 'single_line_empty_body' => true, |
331 | | - 'statement_indentation' => [ |
332 | | - 'stick_comment_to_next_continuous_control_statement' => true, |
333 | | - ], |
334 | | - 'static_lambda' => false, // pest |
335 | | - 'static_private_method' => false, |
| 49 | + '@autoPHPUnitMigration:risky' => true, |
336 | 50 | ]))) |
337 | 51 | ->setUsingCache(true) |
338 | 52 | ->setCacheFile(\sprintf('%s/.build/php-cs-fixer/%s.cache', __DIR__, pathinfo(__FILE__, \PATHINFO_FILENAME))) |
339 | 53 | ->setUnsupportedPhpVersionAllowed(true) |
340 | 54 | ->setFinder( |
341 | | - /** |
342 | | - * @see https://github.com/laravel/pint/blob/main/app/Commands/DefaultCommand.php |
343 | | - * @see https://github.com/laravel/pint/blob/main/app/Factories/ConfigurationFactory.php |
344 | | - * @see https://github.com/laravel/pint/blob/main/app/Repositories/ConfigurationJsonRepository.php |
345 | | - */ |
346 | 55 | Finder::create() |
347 | 56 | ->in(__DIR__) |
348 | 57 | ->exclude([ |
|
0 commit comments