|
| 1 | +<?php |
| 2 | + |
| 3 | +use PhpCsFixer\Config; |
| 4 | +use PhpCsFixer\Finder; |
| 5 | + |
| 6 | +$finder = Finder::create() |
| 7 | + ->in([ |
| 8 | + __DIR__ . '/src', |
| 9 | + __DIR__ . '/tests', |
| 10 | + ]) |
| 11 | + ->name('*.php') |
| 12 | + ->ignoreDotFiles(TRUE) |
| 13 | + ->ignoreVCS(TRUE); |
| 14 | + |
| 15 | +return (new Config()) |
| 16 | + ->setRules([ |
| 17 | + '@PSR12' => TRUE, |
| 18 | + 'array_syntax' => ['syntax' => 'short'], |
| 19 | + 'ordered_imports' => ['sort_algorithm' => 'alpha'], |
| 20 | + 'no_unused_imports' => TRUE, |
| 21 | + 'not_operator_with_successor_space' => TRUE, |
| 22 | + 'trailing_comma_in_multiline' => TRUE, |
| 23 | + 'phpdoc_scalar' => TRUE, |
| 24 | + 'unary_operator_spaces' => TRUE, |
| 25 | + 'binary_operator_spaces' => TRUE, |
| 26 | + 'blank_line_before_statement' => [ |
| 27 | + 'statements' => [ |
| 28 | + 'break', |
| 29 | + 'continue', |
| 30 | + 'declare', |
| 31 | + 'return', |
| 32 | + 'throw', |
| 33 | + 'try', |
| 34 | + ], |
| 35 | + ], |
| 36 | + 'phpdoc_single_line_var_spacing' => TRUE, |
| 37 | + 'phpdoc_var_without_name' => TRUE, |
| 38 | + 'class_attributes_separation' => [ |
| 39 | + 'elements' => [ |
| 40 | + 'method' => 'one', |
| 41 | + ], |
| 42 | + ], |
| 43 | + 'braces' => [ |
| 44 | + 'allow_single_line_closure' => TRUE, |
| 45 | + 'position_after_anonymous_constructs' => 'same', |
| 46 | + 'position_after_functions_and_oop_constructs' => 'next', |
| 47 | + 'position_after_control_structures' => 'same', |
| 48 | + ], |
| 49 | + 'method_argument_space' => [ |
| 50 | + 'on_multiline' => 'ensure_fully_multiline', |
| 51 | + 'keep_multiple_spaces_after_comma' => TRUE, |
| 52 | + ], |
| 53 | + 'single_trait_insert_per_statement' => TRUE, |
| 54 | + ]) |
| 55 | + ->setFinder($finder); |
| 56 | + |
0 commit comments