|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
$finder = PhpCsFixer\Finder::create() |
|
4
|
|
|
->exclude('vendor/*') |
|
5
|
|
|
->exclude('build/*') |
|
6
|
|
|
->in([ |
|
7
|
|
|
__DIR__ . '/src', |
|
8
|
|
|
__DIR__ . '/tests', |
|
9
|
|
|
]) |
|
10
|
|
|
->name('*.php') |
|
11
|
|
|
->ignoreDotFiles(true) |
|
12
|
|
|
->ignoreVCS(true); |
|
13
|
|
|
|
|
14
|
|
|
return (new PhpCsFixer\Config()) |
|
15
|
|
|
->setRules([ |
|
16
|
|
|
'@PSR12' => true, |
|
17
|
|
|
'array_syntax' => ['syntax' => 'short'], |
|
18
|
|
|
'array_indentation' => true, |
|
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' => [ |
|
26
|
|
|
'operators' => ['=>' => 'align_single_space'], |
|
27
|
|
|
], |
|
28
|
|
|
'blank_line_before_statement' => [ |
|
29
|
|
|
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], |
|
30
|
|
|
], |
|
31
|
|
|
'phpdoc_single_line_var_spacing' => true, |
|
32
|
|
|
'phpdoc_var_without_name' => true, |
|
33
|
|
|
'method_argument_space' => [ |
|
34
|
|
|
'on_multiline' => 'ensure_fully_multiline', |
|
35
|
|
|
'keep_multiple_spaces_after_comma' => true, |
|
36
|
|
|
], |
|
37
|
|
|
]) |
|
38
|
|
|
->setFinder($finder); |
|
39
|
|
|
|