Skip to content

Commit 3d44bdc

Browse files
Update PHP-CS-Fixer
1 parent 85dd79e commit 3d44bdc

File tree

6 files changed

+99
-15
lines changed

6 files changed

+99
-15
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/.gitignore export-ignore
33
/.github export-ignore
44
/.phive export-ignore
5-
/.php_cs.dist export-ignore
5+
/.php-cs-fixer.dist.php export-ignore
66
/build.xml export-ignore
77
/phpunit.xml export-ignore
88
/psalm.xml export-ignore

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
coverage: none
2424

2525
- name: Run friendsofphp/php-cs-fixer
26-
run: ./tools/php-cs-fixer fix --diff-format=udiff --dry-run --show-progress=dots --using-cache=no --verbose
26+
run: ./tools/php-cs-fixer fix --dry-run --show-progress=dots --using-cache=no --verbose
2727

2828
type-checker:
2929
name: Type Checker

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/.idea
22
/vendor/
3-
/.php_cs
4-
/.php_cs.cache
3+
/.php-cs-fixer.php
4+
/.php-cs-fixer.cache
55
/composer.lock
66
/.phpunit.result.cache

.phive/phars.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="php-cs-fixer" version="^2.16" installed="2.18.6" location="./tools/php-cs-fixer" copy="true"/>
3+
<phar name="php-cs-fixer" version="^3.0" installed="3.0.0" location="./tools/php-cs-fixer" copy="true"/>
44
<phar name="psalm" version="^4.0" installed="4.7.1" location="./tools/psalm" copy="true"/>
55
<phar name="roave/backwardcompatibilitycheck" version="^5.0.0" installed="5.0.0" location="./tools/roave-backward-compatibility-check" copy="true"/>
66
<phar name="composer" version="^2.0.3" installed="2.0.13" location="./tools/composer" copy="true"/>

.php_cs.dist renamed to .php-cs-fixer.dist.php

+94-10
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@
1111
$finder = PhpCsFixer\Finder::create()
1212
->files()
1313
->in(__DIR__ . '/src')
14-
->in(__DIR__ . '/tests');
14+
->in(__DIR__ . '/tests')
15+
;
1516

16-
return PhpCsFixer\Config::create()
17-
->setFinder($finder)
17+
$config = new PhpCsFixer\Config;
18+
$config->setFinder($finder)
1819
->setRiskyAllowed(true)
1920
->setRules([
2021
'align_multiline_comment' => true,
2122
'array_indentation' => true,
23+
'array_push' => true,
2224
'array_syntax' => ['syntax' => 'short'],
25+
'backtick_to_shell_exec' => true,
2326
'binary_operator_spaces' => [
2427
'operators' => [
25-
'=' => 'align',
26-
'=>' => 'align',
28+
'=' => 'align_single_space_minimal',
29+
'=>' => 'align_single_space_minimal',
2730
],
2831
],
2932
'blank_line_after_namespace' => true,
@@ -32,9 +35,12 @@
3235
'break',
3336
'continue',
3437
'declare',
38+
'default',
3539
'do',
40+
'exit',
3641
'for',
3742
'foreach',
43+
'goto',
3844
'if',
3945
'include',
4046
'include_once',
@@ -50,47 +56,78 @@
5056
],
5157
'braces' => true,
5258
'cast_spaces' => true,
53-
'class_attributes_separation' => ['elements' => ['const', 'method', 'property']],
59+
'class_attributes_separation' => [
60+
'elements' => [
61+
'const' => 'one',
62+
'method' => 'one',
63+
'property' => 'one'
64+
]
65+
],
66+
'class_definition' => true,
67+
'clean_namespace' => true,
5468
'combine_consecutive_issets' => true,
5569
'combine_consecutive_unsets' => true,
70+
'combine_nested_dirname' => true,
5671
'compact_nullable_typehint' => true,
5772
'concat_space' => ['spacing' => 'one'],
73+
'constant_case' => true,
5874
'declare_equal_normalize' => ['space' => 'none'],
5975
'declare_strict_types' => true,
6076
'dir_constant' => true,
77+
'echo_tag_syntax' => true,
6178
'elseif' => true,
6279
'encoding' => true,
80+
'ereg_to_preg' => true,
81+
'explicit_indirect_variable' => true,
82+
'explicit_string_variable' => true,
83+
'fopen_flag_order' => true,
6384
'full_opening_tag' => true,
85+
'fully_qualified_strict_types' => true,
6486
'function_declaration' => true,
87+
'function_to_constant' => true,
88+
'function_typehint_space' => true,
6589
'global_namespace_import' => [
6690
'import_classes' => true,
6791
'import_constants' => true,
6892
'import_functions' => true,
6993
],
7094
'header_comment' => ['header' => $header, 'separate' => 'none'],
95+
'heredoc_to_nowdoc' => true,
96+
'implode_call' => true,
97+
'include' => true,
98+
'increment_style' => [
99+
'style' => PhpCsFixer\Fixer\Operator\IncrementStyleFixer::STYLE_POST,
100+
],
71101
'indentation_type' => true,
72102
'is_null' => true,
103+
'lambda_not_used_import' => true,
73104
'line_ending' => true,
74105
'list_syntax' => ['syntax' => 'short'],
75106
'logical_operators' => true,
76107
'lowercase_cast' => true,
77-
'lowercase_constants' => true,
78108
'lowercase_keywords' => true,
79109
'lowercase_static_reference' => true,
80110
'magic_constant_casing' => true,
81-
'method_argument_space' => ['ensure_fully_multiline' => true],
111+
'magic_method_casing' => true,
112+
'method_argument_space' => [
113+
'on_multiline' => 'ensure_fully_multiline',
114+
],
82115
'modernize_types_casting' => true,
83116
'multiline_comment_opening_closing' => true,
84117
'multiline_whitespace_before_semicolons' => true,
85118
'native_constant_invocation' => false,
86119
'native_function_casing' => false,
87120
'native_function_invocation' => false,
121+
'native_function_type_declaration_casing' => true,
88122
'new_with_braces' => false,
89123
'no_alias_functions' => true,
124+
'no_alias_language_construct_call' => true,
90125
'no_alternative_syntax' => true,
126+
'no_binary_string' => true,
91127
'no_blank_lines_after_class_opening' => true,
92128
'no_blank_lines_after_phpdoc' => true,
93129
'no_blank_lines_before_namespace' => true,
130+
'no_break_comment' => true,
94131
'no_closing_tag' => true,
95132
'no_empty_comment' => true,
96133
'no_empty_phpdoc' => true,
@@ -104,9 +141,9 @@
104141
'no_null_property_initialization' => true,
105142
'no_php4_constructor' => true,
106143
'no_short_bool_cast' => true,
107-
'no_short_echo_tag' => true,
108144
'no_singleline_whitespace_before_semicolons' => true,
109145
'no_spaces_after_function_name' => true,
146+
'no_spaces_around_offset' => true,
110147
'no_spaces_inside_parenthesis' => true,
111148
'no_superfluous_elseif' => true,
112149
'no_superfluous_phpdoc_tags' => [
@@ -116,19 +153,26 @@
116153
'no_trailing_comma_in_singleline_array' => true,
117154
'no_trailing_whitespace' => true,
118155
'no_trailing_whitespace_in_comment' => true,
156+
'no_trailing_whitespace_in_string' => true,
119157
'no_unneeded_control_parentheses' => true,
120158
'no_unneeded_curly_braces' => true,
121159
'no_unneeded_final_method' => true,
122160
'no_unreachable_default_argument_value' => true,
161+
'no_unset_cast' => true,
123162
'no_unset_on_property' => true,
124163
'no_unused_imports' => true,
125164
'no_useless_else' => true,
126165
'no_useless_return' => true,
166+
'no_useless_sprintf' => true,
127167
'no_whitespace_before_comma_in_array' => true,
128168
'no_whitespace_in_blank_line' => true,
129169
'non_printable_character' => true,
130170
'normalize_index_brace' => true,
131171
'object_operator_without_whitespace' => true,
172+
'operator_linebreak' => [
173+
'only_booleans' => true,
174+
'position' => 'end',
175+
],
132176
'ordered_class_elements' => [
133177
'order' => [
134178
'use_trait',
@@ -164,41 +208,79 @@
164208
'direction' => 'ascend',
165209
'order' => 'alpha',
166210
],
211+
'ordered_traits' => true,
212+
'php_unit_set_up_tear_down_visibility' => true,
213+
'php_unit_test_case_static_method_calls' => [
214+
'call_type' => 'this',
215+
],
167216
'phpdoc_add_missing_param_annotation' => false,
168217
'phpdoc_align' => true,
169218
'phpdoc_annotation_without_dot' => true,
170219
'phpdoc_indent' => true,
220+
'phpdoc_inline_tag_normalizer' => true,
171221
'phpdoc_no_access' => true,
222+
'phpdoc_no_alias_tag' => true,
172223
'phpdoc_no_empty_return' => true,
173224
'phpdoc_no_package' => true,
225+
'phpdoc_no_useless_inheritdoc' => true,
174226
'phpdoc_order' => true,
227+
'phpdoc_order_by_value' => [
228+
'annotations' => [
229+
'covers',
230+
'dataProvider',
231+
'throws',
232+
'uses',
233+
],
234+
],
175235
'phpdoc_return_self_reference' => true,
176236
'phpdoc_scalar' => true,
177237
'phpdoc_separation' => true,
178238
'phpdoc_single_line_var_spacing' => true,
179239
'phpdoc_summary' => true,
240+
'phpdoc_tag_casing' => true,
241+
'phpdoc_tag_type' => true,
180242
'phpdoc_to_comment' => true,
181243
'phpdoc_trim' => true,
182244
'phpdoc_trim_consecutive_blank_line_separation' => true,
183245
'phpdoc_types' => ['groups' => ['simple', 'meta']],
184246
'phpdoc_types_order' => true,
247+
'phpdoc_var_annotation_correct_order' => true,
185248
'phpdoc_var_without_name' => true,
186249
'pow_to_exponentiation' => true,
187250
'protected_to_private' => true,
188251
'return_assignment' => true,
189252
'return_type_declaration' => ['space_before' => 'none'],
190253
'self_accessor' => true,
254+
'self_static_accessor' => true,
191255
'semicolon_after_instruction' => true,
192256
'set_type_to_cast' => true,
193257
'short_scalar_cast' => true,
258+
'simple_to_complex_string_variable' => true,
194259
'simplified_null_return' => false,
195260
'single_blank_line_at_eof' => true,
261+
'single_class_element_per_statement' => true,
196262
'single_import_per_statement' => true,
197263
'single_line_after_imports' => true,
198264
'single_quote' => true,
265+
'single_space_after_construct' => true,
266+
'single_trait_insert_per_statement' => true,
267+
'space_after_semicolon' => true,
268+
'standardize_increment' => true,
199269
'standardize_not_equals' => true,
270+
'static_lambda' => true,
271+
'strict_param' => true,
272+
'string_line_ending' => true,
273+
'switch_case_semicolon_to_colon' => true,
274+
'switch_case_space' => true,
275+
'switch_continue_to_break' => true,
276+
'ternary_operator_spaces' => true,
277+
'ternary_to_elvis_operator' => true,
200278
'ternary_to_null_coalescing' => true,
201-
'trailing_comma_in_multiline_array' => true,
279+
'trailing_comma_in_multiline' => [
280+
'elements' => [
281+
'arrays'
282+
]
283+
],
202284
'trim_array_spaces' => true,
203285
'unary_operator_spaces' => true,
204286
'visibility_required' => [
@@ -211,3 +293,5 @@
211293
'void_return' => true,
212294
'whitespace_after_comma_in_array' => true,
213295
]);
296+
297+
return $config;

tools/php-cs-fixer

-43.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)