|
1 | 1 | <?php |
2 | 2 |
|
3 | | -return PhpCsFixer\Config::create() |
| 3 | +$finder = PhpCsFixer\Finder::create() |
| 4 | + ->exclude('files') |
| 5 | + ->exclude('vendor') |
| 6 | + ->in(__DIR__) |
| 7 | + ->name('*.php') |
| 8 | + ->ignoreDotFiles(true) |
| 9 | + ->ignoreVCS(true); |
| 10 | + |
| 11 | +return (new PhpCsFixer\Config) |
4 | 12 | ->setRiskyAllowed(true) |
5 | 13 | ->setRules([ |
| 14 | + '@PSR1' => false, |
6 | 15 | '@PSR2' => true, |
7 | 16 |
|
8 | 17 | /** |
|
13 | 22 | // Remove duplicated semicolons. |
14 | 23 | 'no_empty_statement' => true, |
15 | 24 | // PHP multi-line arrays should have a trailing comma. |
16 | | - 'trailing_comma_in_multiline_array' => true, |
| 25 | + 'trailing_comma_in_multiline' => true, |
17 | 26 | // There should be no empty lines after class opening brace. |
18 | 27 | 'no_blank_lines_after_class_opening' => true, |
19 | 28 | // There should not be blank lines between docblock and the documented element. |
|
23 | 32 | // Phpdocs should start and end with content, excluding the very first and last line of the docblocks. |
24 | 33 | 'phpdoc_trim' => true, |
25 | 34 | // Removes line breaks between use statements. |
26 | | - 'no_extra_consecutive_blank_lines' => ['use'], |
| 35 | + 'no_extra_blank_lines' => ['tokens' => ['use']], |
27 | 36 | // An empty line feed should precede a return statement. |
28 | | - 'blank_line_before_return' => true, |
| 37 | + 'blank_line_before_statement' => true, |
29 | 38 | // There should be exactly one blank line before a namespace declaration. |
30 | 39 | 'single_blank_line_before_namespace' => true, |
31 | 40 | // Convert double quotes to single quotes for simple strings. |
32 | 41 | 'single_quote' => true, |
33 | 42 | // Unused use statements must be removed. |
34 | 43 | 'no_unused_imports' => true, |
35 | 44 | // Methods must be separated with one blank line. |
36 | | - 'method_separation' => true, |
| 45 | + 'class_attributes_separation' => true, |
37 | 46 | // Binary operators should be surrounded by at least one space. |
38 | | - 'binary_operator_spaces' => ['align_double_arrow' => false], |
| 47 | + 'binary_operator_spaces' => ['operators' => ['=>' => 'single_space']], |
39 | 48 | // A single space should be between cast and variable. |
40 | 49 | 'cast_spaces' => true, |
41 | 50 |
|
|
49 | 58 | // PHP arrays should be declared using the configured syntax. |
50 | 59 | 'array_syntax' => ['syntax' => 'short'] |
51 | 60 | ]) |
52 | | - ->setFinder( |
53 | | - PhpCsFixer\Finder::create() |
54 | | - ->exclude('files') |
55 | | - ->exclude('vendor') |
56 | | - ->in(__DIR__) |
57 | | - ->name('*.php') |
58 | | - ->ignoreDotFiles(true) |
59 | | - ->ignoreVCS(true) |
60 | | - ) |
| 61 | + ->setFinder($finder) |
61 | 62 | ->setUsingCache(true); |
0 commit comments