-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php-cs-fixer.php
109 lines (90 loc) · 2.3 KB
/
.php-cs-fixer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
declare(strict_types=1);
use PhpCsFixer\RuleSet\RuleSet;
use PhpCsFixer\RuleSet\RuleSets;
$finder = PhpCsFixer\Finder::create()
->in('./src/')
->in('./tests/')
->append(['.php-cs-fixer.php']);
$ruleSet = new RuleSet();
$rules = array_reduce(
RuleSets::getSetDefinitionNames(),
static function (array $carry, string $ruleSetName): array {
$carry[$ruleSetName] = true;
return $carry;
},
[]
);
$rules['blank_line_before_statement'] = [
'statements' => [
'break',
'case',
'continue',
'default',
'exit',
'for',
'foreach',
'if',
'return',
'switch',
'throw',
'try',
'while',
'yield',
],
];
$rules['class_attributes_separation'] = [
'elements' => [
'method' => 'one',
'property' => 'one',
],
];
$rules['global_namespace_import'] = true;
$rules['linebreak_after_opening_tag'] = true;
$rules['mb_str_functions'] = true;
$rules['ordered_class_elements'] = [
'sort_algorithm' => 'alpha',
'order' => [
'use_trait',
'constant',
'constant_public',
'constant_protected',
'constant_private',
'property_static',
'property_public_static',
'property',
'property_public',
'property_protected_static',
'property_protected',
'property_private_static',
'property_private',
'construct',
'method_public_static',
'method',
'method_public',
'method_protected_static',
'method_protected',
'method_private_static',
'method_private',
'magic',
'destruct',
'phpunit',
],
];
$rules['phpdoc_line_span'] = [
'property' => 'single',
];
// disable in favor of Prettier
$rules['concat_space'] = false;
$rules['function_declaration'] = false;
$rules['multiline_whitespace_before_semicolons'] = false;
$rules['operator_linebreak'] = false;
$rules['types_spaces'] = false;
$rules['single_line_throw'] = false;
$rules['static_lambda'] = true;
$rules['use_arrow_functions'] = true;
$rules['no_superfluous_phpdoc_tags'] = false;
$rules['phpdoc_to_comment'] = [
'ignored_tags' => ['psalm-suppress'],
];
return (new PhpCsFixer\Config())->setRules($rules)->setFinder($finder);