forked from SimpleMachines/SMF
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.php-cs-fixer.dist.php
198 lines (177 loc) · 4.28 KB
/
.php-cs-fixer.dist.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php
/**
* Simple Machines Forum (SMF)
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2024 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 3.0 Alpha 2
*/
$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
// Don't touch libraries.
->exclude([
'cache',
'other',
'Packages',
'Smileys',
'Sources/minify',
'Sources/random_compat',
'Sources/ReCaptcha',
'Themes',
])
// Skip all index.php files and ssi_example.php.
->notName(['index.php', 'ssi_examples.php'])
// Skip anything being ignored in .gitignore.
->ignoreVCSIgnored(true);
require_once('.github/phpcs/SMFClosingTag.php');
return (new PhpCsFixer\Config())
->registerCustomFixers([
new \SMF\Fixer\Whitespace\closing_tag_fixer(),
])
->setRules([
'@PSR12' => true,
// A custom fixer for us to apply our line endings.
'SMF/closing_tag_fixer' => true,
// PSR12 overrides.
'no_closing_tag' => false,
'no_break_comment' => false, // A bit buggy with comments.
'statement_indentation' => false, // A bit buggy with comments.
// Array notation.
'array_syntax' => ['syntax' => 'short'],
'normalize_index_brace' => true,
'whitespace_after_comma_in_array' => true,
// Basic.
'no_trailing_comma_in_singleline' => true,
// Casing.
'class_reference_name_casing' => true,
// Cast notation.
'cast_spaces' => ['space' => 'single'],
// Control structure.
'include' => true,
'no_superfluous_elseif' => true,
'no_useless_else' => true,
'simplified_if_return' => true,
'trailing_comma_in_multiline' => [
'after_heredoc' => true,
'elements' => [
'arguments',
'arrays',
'match',
'parameters',
],
],
// Function notation.
'lambda_not_used_import' => true,
'nullable_type_declaration_for_default_null_value' => true,
// Import.
'no_unused_imports' => true,
'ordered_imports' => [
'imports_order' => [
'class',
'function',
'const',
],
'sort_algorithm' => 'alpha',
],
// Language construct.
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'nullable_type_declaration' => ['syntax' => 'question_mark'],
// Namespace notation.
'no_leading_namespace_whitespace' => true,
// Operator.
'concat_space' => ['spacing' => 'one'],
'operator_linebreak' => [
'only_booleans' => true,
'position' => 'beginning',
],
'standardize_not_equals' => true,
'ternary_to_null_coalescing' => true,
// PHPDoc.
'phpdoc_indent' => true,
'phpdoc_line_span' => [
'const' => 'multi',
'property' => 'multi',
'method' => 'multi',
],
'phpdoc_no_access' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => [
'order' => [
'param',
'throws',
'return',
],
],
'phpdoc_no_empty_return' => true,
'phpdoc_param_order' => true,
'phpdoc_scalar' => [
'types' => [
'boolean',
'callback',
'double',
'integer',
'real',
'str',
],
],
'phpdoc_to_comment' => [
'ignored_tags' => ['todo'],
],
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => [
'groups' => ['alias', 'meta', 'simple'],
],
'phpdoc_var_without_name' => true,
// Return notation.
'no_useless_return' => true,
'simplified_null_return' => true,
// Semicolon.
'multiline_whitespace_before_semicolons' => true,
'no_empty_statement' => true,
'no_singleline_whitespace_before_semicolons' => true,
// String notation.
'explicit_string_variable' => true,
'simple_to_complex_string_variable' => true,
'single_quote' => true,
// Whitespace.
'array_indentation' => true,
'blank_line_before_statement' => [
'statements' => [
'case',
'declare',
'default',
'do',
'exit',
'for',
'foreach',
'goto',
'if',
'include',
'include_once',
'require',
'require_once',
'return',
'switch',
'throw',
'try',
'while',
'yield',
'yield_from',
],
],
'heredoc_indentation' => ['indentation' => 'start_plus_one'],
'method_chaining_indentation' => true,
'no_spaces_around_offset' => [
'positions' => ['inside', 'outside'],
],
'type_declaration_spaces' => [
'elements' => ['function', 'property'],
],
])
->setIndent("\t")
->setFinder($finder);
?>