|
1 | 1 | <?php |
2 | 2 |
|
3 | | -$finder = Symfony\CS\Finder\DefaultFinder::create() |
4 | | - ->in(__DIR__ . '/src') |
5 | | - ->in(__DIR__ . '/test'); |
6 | | - |
7 | | -return Symfony\CS\Config\Config::create() |
8 | | - ->setUsingCache(true) |
9 | | - ->setUsingLinter(true) |
10 | | - ->level(Symfony\CS\FixerInterface::PSR2_LEVEL) |
11 | | - ->fixers(array( |
12 | | - '-psr0', |
13 | | - )) |
14 | | - ->finder($finder); |
| 3 | +$config = PhpCsFixer\Config::create(); |
| 4 | +$config->setRiskyAllowed(true); |
| 5 | +$config->setRules([ |
| 6 | + '@PSR2' => true, |
| 7 | + 'array_syntax' => [ |
| 8 | + 'syntax' => 'short', |
| 9 | + ], |
| 10 | + 'binary_operator_spaces' => [ |
| 11 | + 'align_double_arrow' => false, |
| 12 | + 'align_equals' => false, |
| 13 | + ], |
| 14 | + 'blank_line_after_namespace' => true, |
| 15 | + 'blank_line_after_opening_tag' => true, |
| 16 | + 'blank_line_before_statement' => ['statements' => ['return']], |
| 17 | + 'concat_space' => ['spacing' => 'one'], |
| 18 | + 'function_typehint_space' => true, |
| 19 | + 'lowercase_cast' => true, |
| 20 | + 'method_separation' => true, |
| 21 | + 'native_function_casing' => true, |
| 22 | + 'new_with_braces' => true, |
| 23 | + 'no_empty_comment' => true, |
| 24 | + 'no_empty_phpdoc' => true, |
| 25 | + 'no_empty_statement' => true, |
| 26 | + 'no_extra_consecutive_blank_lines' => [ |
| 27 | + 'tokens' => [ |
| 28 | + 'curly_brace_block', |
| 29 | + 'extra', |
| 30 | + 'parenthesis_brace_block', |
| 31 | + 'square_brace_block', |
| 32 | + 'throw', |
| 33 | + 'use', |
| 34 | + ], |
| 35 | + ], |
| 36 | + 'no_leading_import_slash' => true, |
| 37 | + 'no_leading_namespace_whitespace' => true, |
| 38 | + 'no_multiline_whitespace_around_double_arrow' => true, |
| 39 | + 'no_short_bool_cast' => true, |
| 40 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 41 | + 'no_trailing_comma_in_singleline_array' => true, |
| 42 | + 'no_unneeded_control_parentheses' => true, |
| 43 | + 'no_unused_imports' => true, |
| 44 | + 'no_whitespace_before_comma_in_array' => true, |
| 45 | + 'no_whitespace_in_blank_line' => true, |
| 46 | + 'normalize_index_brace' => true, |
| 47 | + 'not_operator_with_successor_space' => true, |
| 48 | + 'object_operator_without_whitespace' => true, |
| 49 | + 'ordered_imports' => true, |
| 50 | + 'php_unit_construct' => true, |
| 51 | + 'php_unit_dedicate_assert' => true, |
| 52 | + 'phpdoc_single_line_var_spacing' => true, |
| 53 | + 'phpdoc_trim' => true, |
| 54 | + 'pre_increment' => true, |
| 55 | + 'psr4' => true, |
| 56 | + 'random_api_migration' => true, |
| 57 | + 'self_accessor' => true, |
| 58 | + 'short_scalar_cast' => true, |
| 59 | + 'single_blank_line_before_namespace' => true, |
| 60 | + 'single_class_element_per_statement' => true, |
| 61 | + 'single_quote' => true, |
| 62 | + 'space_after_semicolon' => true, |
| 63 | + 'standardize_not_equals' => true, |
| 64 | + 'ternary_operator_spaces' => true, |
| 65 | + 'trailing_comma_in_multiline_array' => true, |
| 66 | + 'trim_array_spaces' => true, |
| 67 | + 'unary_operator_spaces' => true, |
| 68 | + 'whitespace_after_comma_in_array' => true, |
| 69 | +]); |
| 70 | + |
| 71 | +$finder = PhpCsFixer\Finder::create(); |
| 72 | +$finder->in([ |
| 73 | + 'src', |
| 74 | + 'test', |
| 75 | +]); |
| 76 | + |
| 77 | +$config->setFinder($finder); |
| 78 | + |
| 79 | +return $config; |
0 commit comments