|
1 | 1 | <?php |
2 | 2 |
|
| 3 | +/** |
| 4 | + * @noinspection PhpUndefinedClassInspection |
| 5 | + * @noinspection PhpUndefinedNamespaceInspection |
| 6 | + * @see https://cs.symfony.com/doc/ruleSets/ |
| 7 | + * @see https://cs.symfony.com/doc/rules/ |
| 8 | + */ |
| 9 | + |
3 | 10 | declare(strict_types=1); |
4 | 11 |
|
5 | | -return PhpCsFixer\Config::create() |
| 12 | +return (new PhpCsFixer\Config()) |
6 | 13 | ->setRiskyAllowed(true) |
7 | | - ->setCacheFile(__DIR__ . '/build/.php_cs.cache') |
| 14 | + ->setCacheFile(__DIR__ . '/build/php_cs.cache') |
8 | 15 | ->setRules([ |
9 | | - '@PSR2' => true, |
10 | | - '@PHP70Migration' => true, |
11 | | - '@PHP70Migration:risky' => true, |
12 | | - '@PHP71Migration' => true, |
| 16 | + '@PSR12' => true, |
| 17 | + '@PSR12:risky' => true, |
13 | 18 | '@PHP71Migration:risky' => true, |
| 19 | + '@PHP73Migration' => true, |
| 20 | + // PSR12 (remove when php-cs-fixer reaches ^3.1.1) |
| 21 | + 'class_definition' => ['space_before_parenthesis' => true], |
14 | 22 | // symfony |
15 | | - 'class_attributes_separation' => true, |
| 23 | + // 'class_attributes_separation' => true, // conflict with PSR12 |
16 | 24 | 'whitespace_after_comma_in_array' => true, |
17 | 25 | 'no_empty_statement' => true, |
18 | 26 | 'no_extra_blank_lines' => true, |
19 | 27 | 'function_typehint_space' => true, |
20 | | - 'no_alias_functions' => true, |
21 | | - 'trailing_comma_in_multiline_array' => true, |
22 | | - 'new_with_braces' => true, |
23 | | - 'no_blank_lines_after_class_opening' => true, |
24 | 28 | 'no_blank_lines_after_phpdoc' => true, |
25 | 29 | 'object_operator_without_whitespace' => true, |
26 | 30 | 'binary_operator_spaces' => true, |
27 | 31 | 'phpdoc_scalar' => true, |
28 | | - 'self_accessor' => true, |
29 | 32 | 'no_trailing_comma_in_singleline_array' => true, |
30 | 33 | 'single_quote' => true, |
31 | 34 | 'no_singleline_whitespace_before_semicolons' => true, |
32 | 35 | 'no_unused_imports' => true, |
33 | | - 'no_whitespace_in_blank_line' => true, |
34 | 36 | 'yoda_style' => ['equal' => true, 'identical' => true, 'less_and_greater' => null], |
35 | 37 | 'standardize_not_equals' => true, |
36 | | - // contrib |
37 | 38 | 'concat_space' => ['spacing' => 'one'], |
38 | | - 'not_operator_with_successor_space' => true, |
39 | | - 'single_blank_line_before_namespace' => true, |
40 | 39 | 'linebreak_after_opening_tag' => true, |
41 | | - 'blank_line_after_opening_tag' => true, |
42 | | - 'ordered_imports' => true, |
43 | | - 'array_syntax' => ['syntax' => 'short'], |
| 40 | + // symfony:risky |
| 41 | + 'no_alias_functions' => true, |
| 42 | + 'self_accessor' => true, |
| 43 | + // contrib |
| 44 | + 'not_operator_with_successor_space' => true, |
44 | 45 | ]) |
45 | 46 | ->setFinder( |
46 | 47 | PhpCsFixer\Finder::create() |
47 | 48 | ->in(__DIR__) |
| 49 | + ->append([__FILE__]) |
48 | 50 | ->exclude(['vendor', 'build']) |
49 | 51 | ) |
50 | 52 | ; |
0 commit comments