|
1 | 1 | <?php
|
2 | 2 |
|
3 |
| -$finder = Symfony\Component\Finder\Finder::create() |
| 3 | +use PhpCsFixer\Config; |
| 4 | +use PhpCsFixer\Finder; |
| 5 | + |
| 6 | +$rules = [ |
| 7 | + '@PSR2' => true, |
| 8 | + 'array_indentation' => true, |
| 9 | + 'array_syntax' => ['syntax' => 'short'], |
| 10 | + 'binary_operator_spaces' => true, |
| 11 | + 'blank_line_before_statement' => [ |
| 12 | + 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], |
| 13 | + ], |
| 14 | + 'class_attributes_separation' => [ |
| 15 | + 'elements' => ['const' => 'one','method' => 'one','property' => 'one'], |
| 16 | + ], |
| 17 | + 'concat_space' => ['spacing' => 'one'], |
| 18 | + 'method_argument_space' => [ |
| 19 | + 'on_multiline' => 'ensure_fully_multiline', |
| 20 | + 'keep_multiple_spaces_after_comma' => true, |
| 21 | + ], |
| 22 | + 'method_chaining_indentation' => true, |
| 23 | + 'no_unused_imports' => true, |
| 24 | + 'not_operator_with_successor_space' => false, |
| 25 | + 'ordered_imports' => ['sort_algorithm' => 'alpha'], |
| 26 | + 'phpdoc_scalar' => true, |
| 27 | + 'phpdoc_single_line_var_spacing' => true, |
| 28 | + 'phpdoc_var_without_name' => true, |
| 29 | + 'return_type_declaration' => true, |
| 30 | + 'single_quote' => true, |
| 31 | + 'single_trait_insert_per_statement' => true, |
| 32 | + 'trailing_comma_in_multiline' => true, |
| 33 | + 'unary_operator_spaces' => true, |
| 34 | +]; |
| 35 | + |
| 36 | +$finder = Finder::create() |
4 | 37 | ->in([
|
5 | 38 | __DIR__ . '/src',
|
6 | 39 | __DIR__ . '/tests',
|
|
10 | 43 | ->ignoreDotFiles(true)
|
11 | 44 | ->ignoreVCS(true);
|
12 | 45 |
|
13 |
| -return (new PhpCsFixer\Config()) |
14 |
| - ->setRules([ |
15 |
| - '@PSR2' => true, |
16 |
| - 'array_syntax' => ['syntax' => 'short'], |
17 |
| - 'ordered_imports' => ['sort_algorithm' => 'alpha'], |
18 |
| - 'no_unused_imports' => true, |
19 |
| - 'not_operator_with_successor_space' => false, |
20 |
| - 'trailing_comma_in_multiline' => true, |
21 |
| - 'phpdoc_scalar' => true, |
22 |
| - 'unary_operator_spaces' => true, |
23 |
| - 'binary_operator_spaces' => true, |
24 |
| - 'blank_line_before_statement' => [ |
25 |
| - 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], |
26 |
| - ], |
27 |
| - 'phpdoc_single_line_var_spacing' => true, |
28 |
| - 'phpdoc_var_without_name' => true, |
29 |
| - 'method_argument_space' => [ |
30 |
| - 'on_multiline' => 'ensure_fully_multiline', |
31 |
| - 'keep_multiple_spaces_after_comma' => true, |
32 |
| - ], |
33 |
| - 'single_trait_insert_per_statement' => true, |
34 |
| - 'single_quote' => true, |
35 |
| - ]) |
| 46 | +return (new Config()) |
| 47 | + ->setRules($rules) |
36 | 48 | ->setFinder($finder);
|
0 commit comments