-
-
Notifications
You must be signed in to change notification settings - Fork 404
/
.php-cs-fixer.php
184 lines (180 loc) · 7.04 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
181
182
183
184
<?php
$header = <<<'EOF'
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2024 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDtool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
EOF;
$finder = PhpCsFixer\Finder::create()
->exclude('tests', 'include/vendor', 'include/fa', 'plugins', 'vendor')
->in(__DIR__)
// ->append([
// __DIR__.'/dev-tools/doc.php',
// __DIR__.'/php-cs-fixer',
// ])
;
$config = new PhpCsFixer\Config();
$config
->setRiskyAllowed(true)
->setIndent("\t")
->setRules([
// '@PHP56Migration' => true,
// '@PhpCsFixer' => true,
// '@PhpCsFixer:risky' => true,
'header_comment' => false,
// 'header_comment' => [
// 'header' => $header,
// 'comment_type' => 'comment',
// 'separate' => 'bottom'
// ],
'list_syntax' => [
'syntax' => 'long'
],
'array_syntax' => [
'syntax' => 'long'
],
'trim_array_spaces' => false,
'no_whitespace_before_comma_in_array' => true,
'no_multiline_whitespace_around_double_arrow' => false,
'normalize_index_brace' => true,
'no_mixed_echo_print' => [
'use' => 'print'
],
'no_spaces_after_function_name' => true,
'braces' => [
'position_after_functions_and_oop_constructs' => 'same',
'position_after_control_structures' => 'same',
'allow_single_line_closure' => true,
],
'single_blank_line_at_eof' => true,
'no_whitespace_in_blank_line' => true,
'no_trailing_whitespace' => true,
'method_chaining_indentation' => true,
'indentation_type' => true,
'constant_case' => [
'case' => 'lower',
],
'lowercase_keywords' => true,
'line_ending' => true,
'magic_constant_casing' => true,
'native_function_casing' => true,
'elseif' => true,
'include' => false,
'no_alternative_syntax' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline' => true,
'no_unneeded_curly_braces' => true,
'no_useless_else' => false,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => null,
'always_move_variable' => false
],
'declare_equal_normalize' => [
'space' => 'single'
],
'dir_constant' => true,
'single_space_after_construct' => [
'constructs' => [
'abstract', 'as', 'attribute', 'break', 'case',
'catch', 'class', 'clone', 'const', 'const_import',
'continue', 'do', 'echo', 'else', 'elseif', 'extends',
'final', 'finally', 'for', 'foreach', 'function',
'function_import', 'global', 'goto', 'if', 'implements',
'include', 'include_once', 'require', 'require_once',
'instanceof', 'insteadof', 'interface', 'match',
'named_argument', 'new', 'open_tag_with_echo', 'php_open',
'print', 'private', 'protected', 'public', 'return',
'static', 'throw', 'trait', 'try', 'use', 'use_lambda',
'use_trait', 'var', 'while', 'yield', 'yield_from'
],
],
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'switch_continue_to_break' => true,
'logical_operators' => true,
'function_declaration' => [
'closure_function_spacing' => 'one'
],
'no_spaces_inside_parenthesis' => true,
'binary_operator_spaces' => [
'operators' => [
'+=' => 'align_single_space',
'===' => 'align_single_space_minimal',
'=' => 'align',
'|' => 'single_space',
'=>' => 'align',
'!=' => 'align',
],
],
'not_operator_with_space' => false,
'no_spaces_around_offset' => [
'positions' => [
'outside',
'inside'
],
],
'standardize_not_equals' => true,
'ternary_operator_spaces' => false,
'full_opening_tag' => true,
'linebreak_after_opening_tag' => true,
'align_multiline_comment' => [
'comment_type' => 'phpdocs_like'
],
'phpdoc_add_missing_param_annotation' => true,
'no_extra_blank_lines' => [
'tokens' => [
'attribute', 'break', 'case', 'continue', 'curly_brace_block',
'default', 'extra', 'parenthesis_brace_block', 'return',
'square_brace_block', 'switch', 'throw', 'use',
],
],
'no_empty_statement' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'no_singleline_whitespace_before_semicolons' => true,
'semicolon_after_instruction' => false,
//'space_after_semicolon' => [
// 'remove_in_empty_for_expressions' => true
//],
'blank_line_before_statement' => [
'statements' => [
'break', 'continue', 'declare', 'default', 'do', 'exit',
'for', 'foreach', 'goto', 'if', 'return', 'switch',
'throw', 'try', 'while', 'yield', 'yield_from'
],
],
'explicit_string_variable' => false,
'single_quote' => true,
'string_line_ending' => true,
'strict_param' => true,
'class_attributes_separation' => [
'elements' => [
'const' => 'only_if_meta',
'method' => 'one',
'property' => 'one',
'trait_import' => 'only_if_meta',
'case' => 'only_if_meta',
],
],
])
->setFinder($finder);
return $config;