-
Notifications
You must be signed in to change notification settings - Fork 17
/
.php-cs-fixer.php
180 lines (172 loc) · 5.84 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . DIRECTORY_SEPARATOR . 'src')
->in(__DIR__ . DIRECTORY_SEPARATOR . 'tests')
->name(['*.php']);
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR1' => true,
'@PSR2' => true,
'@PSR12' => true,
// Override standards defined in PSR rule sets
'blank_line_after_opening_tag' => false,
'linebreak_after_opening_tag' => false,
'array_syntax' => ['syntax' => 'short'],
'trailing_comma_in_multiline' => ['after_heredoc' => false, 'elements' => ['arrays', 'arguments', 'parameters', 'match']],
'no_trailing_comma_in_singleline_array' => true,
'array_indentation' => true,
'trim_array_spaces' => true,
'normalize_index_brace' => true,
'no_spaces_around_offset' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'single_quote' => ['strings_containing_single_quote_chars' => true],
'class_attributes_separation' => true,
'no_unneeded_curly_braces' => true,
'no_useless_else' => true,
'return_assignment' => true,
'no_unused_imports' => true,
'lowercase_static_reference' => true,
'lowercase_cast' => true,
'native_function_casing' => true,
'declare_equal_normalize' => [
'space' => 'none',
],
'include' => true,
'function_typehint_space' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_trailing_comma_in_list_call' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'short_scalar_cast' => true,
'standardize_not_equals' => true,
'modernize_types_casting' => true,
'combine_nested_dirname' => true,
'heredoc_indentation' => true,
'pow_to_exponentiation' => true,
'ternary_to_null_coalescing' => true,
'visibility_required' => ['elements' => ['property', 'method', 'const']],
'phpdoc_align' => ['align' => 'left'],
'phpdoc_indent' => true,
'phpdoc_order' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'],
'multiline_comment_opening_closing' => true,
'new_with_braces' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'phpdoc_annotation_without_dot' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'space_after_semicolon' => true,
'concat_space' => ['spacing' => 'one'],
'blank_line_before_statement' => [
'statements' => [
'case',
'continue',
'declare',
'return',
'throw',
'try',
'if',
'for',
'foreach',
],
],
'unary_operator_spaces' => true,
'method_chaining_indentation' => true,
'ternary_operator_spaces' => true,
'cast_spaces' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'implode_call' => true,
'method_argument_space' => [
'after_heredoc' => false,
'keep_multiple_spaces_after_comma' => false,
'on_multiline' => 'ignore',
],
'no_alias_functions' => true,
'switch_case_space' => true,
'single_line_after_imports' => true,
'single_trait_insert_per_statement' => true,
'switch_case_semicolon_to_colon' => true,
'single_class_element_per_statement' => true,
'ordered_imports' => [
'sort_algorithm' => 'length',
'imports_order' => [
'const',
'class',
'function',
],
],
'compact_nullable_typehint' => true,
'return_type_declaration' => ['space_before' => 'none'],
'single_space_after_construct' => [
'constructs' => [
'abstract',
'as',
'attribute',
'break',
'case',
'catch',
'class',
'clone',
'comment',
'const',
'const_import',
'continue',
'do',
'echo',
'else',
'elseif',
'extends',
'final',
'finally',
'for',
'foreach',
'function',
'function_import',
'global',
'goto',
'if',
'implements',
'include',
'include_once',
'instanceof',
'insteadof',
'interface',
'match',
'named_argument',
'new',
'open_tag_with_echo',
'php_doc',
'php_open',
'print',
'private',
'protected',
'public',
'require',
'require_once',
'return',
'static',
'throw',
'trait',
'try',
'use',
'use_lambda',
'use_trait',
'var',
'while',
'yield',
'yield_from',
],
],
])
->setFinder($finder);