Skip to content

Commit f07609a

Browse files
committed
Rename .php_cs to .php-cs-fixer.php
1 parent ccc343f commit f07609a

File tree

3 files changed

+295
-52
lines changed

3 files changed

+295
-52
lines changed

β€Ž.php-cs-fixer.php

+293
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$finder = PhpCsFixer\Finder::create()
6+
->files()
7+
->in(__DIR__ . '/src')
8+
->in(__DIR__ . '/tests')
9+
->notName('*.phpt');
10+
11+
$config = new PhpCsFixer\Config;
12+
$config->setFinder($finder)
13+
->setRiskyAllowed(true)
14+
->setRules([
15+
'align_multiline_comment' => true,
16+
'array_indentation' => true,
17+
'array_push' => true,
18+
'array_syntax' => ['syntax' => 'short'],
19+
'backtick_to_shell_exec' => true,
20+
'binary_operator_spaces' => [
21+
'operators' => [
22+
'=' => 'align_single_space_minimal',
23+
'=>' => 'align_single_space_minimal',
24+
// Workaround for https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/5495
25+
'|' => null,
26+
],
27+
],
28+
'blank_line_after_namespace' => true,
29+
'blank_line_before_statement' => [
30+
'statements' => [
31+
'break',
32+
'continue',
33+
'declare',
34+
'default',
35+
'do',
36+
'exit',
37+
'for',
38+
'foreach',
39+
'goto',
40+
'if',
41+
'include',
42+
'include_once',
43+
'require',
44+
'require_once',
45+
'return',
46+
'switch',
47+
'throw',
48+
'try',
49+
'while',
50+
'yield',
51+
],
52+
],
53+
'braces' => true,
54+
'cast_spaces' => true,
55+
'class_attributes_separation' => [
56+
'elements' => [
57+
'const' => 'one',
58+
'method' => 'one',
59+
'property' => 'one'
60+
]
61+
],
62+
'class_definition' => true,
63+
'clean_namespace' => true,
64+
'combine_consecutive_issets' => true,
65+
'combine_consecutive_unsets' => true,
66+
'combine_nested_dirname' => true,
67+
'compact_nullable_typehint' => true,
68+
'concat_space' => ['spacing' => 'one'],
69+
'constant_case' => true,
70+
'declare_equal_normalize' => ['space' => 'none'],
71+
'declare_strict_types' => true,
72+
'dir_constant' => true,
73+
'echo_tag_syntax' => true,
74+
'elseif' => true,
75+
'encoding' => true,
76+
'ereg_to_preg' => true,
77+
'explicit_indirect_variable' => true,
78+
'explicit_string_variable' => true,
79+
'fopen_flag_order' => true,
80+
'full_opening_tag' => true,
81+
'fully_qualified_strict_types' => true,
82+
'function_declaration' => true,
83+
'function_to_constant' => true,
84+
'function_typehint_space' => true,
85+
'global_namespace_import' => [
86+
'import_classes' => true,
87+
'import_constants' => true,
88+
'import_functions' => true,
89+
],
90+
// 'header_comment' => ['separate' => 'none'],
91+
'heredoc_to_nowdoc' => true,
92+
'implode_call' => true,
93+
'include' => true,
94+
'increment_style' => [
95+
'style' => PhpCsFixer\Fixer\Operator\IncrementStyleFixer::STYLE_POST,
96+
],
97+
'indentation_type' => true,
98+
'is_null' => true,
99+
'lambda_not_used_import' => true,
100+
'line_ending' => true,
101+
'list_syntax' => ['syntax' => 'short'],
102+
'logical_operators' => true,
103+
'lowercase_cast' => true,
104+
'lowercase_keywords' => true,
105+
'lowercase_static_reference' => true,
106+
'magic_constant_casing' => true,
107+
'magic_method_casing' => true,
108+
'method_argument_space' => [
109+
'on_multiline' => 'ensure_fully_multiline',
110+
],
111+
'modernize_types_casting' => true,
112+
'multiline_comment_opening_closing' => true,
113+
'multiline_whitespace_before_semicolons' => true,
114+
'native_constant_invocation' => false,
115+
'native_function_casing' => false,
116+
'native_function_invocation' => false,
117+
'native_function_type_declaration_casing' => true,
118+
'new_with_braces' => false,
119+
'no_alias_functions' => true,
120+
'no_alias_language_construct_call' => true,
121+
'no_alternative_syntax' => true,
122+
'no_binary_string' => true,
123+
'no_blank_lines_after_class_opening' => true,
124+
'no_blank_lines_after_phpdoc' => true,
125+
'no_blank_lines_before_namespace' => true,
126+
'no_break_comment' => true,
127+
'no_closing_tag' => true,
128+
'no_empty_comment' => true,
129+
'no_empty_phpdoc' => true,
130+
'no_empty_statement' => true,
131+
'no_extra_blank_lines' => true,
132+
'no_homoglyph_names' => true,
133+
'no_leading_import_slash' => true,
134+
'no_leading_namespace_whitespace' => true,
135+
'no_mixed_echo_print' => ['use' => 'print'],
136+
'no_multiline_whitespace_around_double_arrow' => true,
137+
'no_null_property_initialization' => true,
138+
'no_php4_constructor' => true,
139+
'no_short_bool_cast' => true,
140+
'no_singleline_whitespace_before_semicolons' => true,
141+
'no_spaces_after_function_name' => true,
142+
'no_spaces_around_offset' => true,
143+
'no_spaces_inside_parenthesis' => true,
144+
'no_superfluous_elseif' => true,
145+
'no_superfluous_phpdoc_tags' => [
146+
'allow_mixed' => true,
147+
],
148+
'no_trailing_comma_in_list_call' => true,
149+
'no_trailing_comma_in_singleline_array' => true,
150+
'no_trailing_whitespace' => true,
151+
'no_trailing_whitespace_in_comment' => true,
152+
'no_trailing_whitespace_in_string' => true,
153+
'no_unneeded_control_parentheses' => true,
154+
'no_unneeded_curly_braces' => true,
155+
'no_unneeded_final_method' => true,
156+
'no_unreachable_default_argument_value' => true,
157+
'no_unset_cast' => true,
158+
'no_unset_on_property' => true,
159+
'no_unused_imports' => true,
160+
'no_useless_else' => true,
161+
'no_useless_return' => true,
162+
'no_useless_sprintf' => true,
163+
'no_whitespace_before_comma_in_array' => true,
164+
'no_whitespace_in_blank_line' => true,
165+
'non_printable_character' => true,
166+
'normalize_index_brace' => true,
167+
'object_operator_without_whitespace' => true,
168+
'operator_linebreak' => [
169+
'only_booleans' => true,
170+
'position' => 'end',
171+
],
172+
'ordered_class_elements' => [
173+
'order' => [
174+
'use_trait',
175+
'constant_public',
176+
'constant_protected',
177+
'constant_private',
178+
'property_public_static',
179+
'property_protected_static',
180+
'property_private_static',
181+
'property_public',
182+
'property_protected',
183+
'property_private',
184+
'method_public_static',
185+
'construct',
186+
'destruct',
187+
'magic',
188+
'phpunit',
189+
'method_public',
190+
'method_protected',
191+
'method_private',
192+
'method_protected_static',
193+
'method_private_static',
194+
],
195+
],
196+
'ordered_imports' => [
197+
'imports_order' => [
198+
PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CONST,
199+
PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_FUNCTION,
200+
PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CLASS,
201+
]
202+
],
203+
'ordered_interfaces' => [
204+
'direction' => 'ascend',
205+
'order' => 'alpha',
206+
],
207+
'ordered_traits' => true,
208+
'php_unit_set_up_tear_down_visibility' => true,
209+
'php_unit_test_case_static_method_calls' => [
210+
'call_type' => 'this',
211+
],
212+
'phpdoc_add_missing_param_annotation' => false,
213+
'phpdoc_align' => true,
214+
'phpdoc_annotation_without_dot' => true,
215+
'phpdoc_indent' => true,
216+
'phpdoc_inline_tag_normalizer' => true,
217+
'phpdoc_no_access' => true,
218+
'phpdoc_no_alias_tag' => true,
219+
'phpdoc_no_empty_return' => true,
220+
'phpdoc_no_package' => true,
221+
'phpdoc_no_useless_inheritdoc' => true,
222+
'phpdoc_order' => true,
223+
'phpdoc_order_by_value' => [
224+
'annotations' => [
225+
'covers',
226+
'dataProvider',
227+
'throws',
228+
'uses',
229+
],
230+
],
231+
'phpdoc_return_self_reference' => true,
232+
'phpdoc_scalar' => true,
233+
'phpdoc_separation' => true,
234+
'phpdoc_single_line_var_spacing' => true,
235+
'phpdoc_summary' => true,
236+
'phpdoc_tag_casing' => true,
237+
'phpdoc_tag_type' => true,
238+
'phpdoc_to_comment' => true,
239+
'phpdoc_trim' => true,
240+
'phpdoc_trim_consecutive_blank_line_separation' => true,
241+
'phpdoc_types' => ['groups' => ['simple', 'meta']],
242+
'phpdoc_types_order' => true,
243+
'phpdoc_var_annotation_correct_order' => true,
244+
'phpdoc_var_without_name' => true,
245+
'pow_to_exponentiation' => true,
246+
'protected_to_private' => true,
247+
'return_assignment' => true,
248+
'return_type_declaration' => ['space_before' => 'none'],
249+
'self_accessor' => true,
250+
'self_static_accessor' => true,
251+
'semicolon_after_instruction' => true,
252+
'set_type_to_cast' => true,
253+
'short_scalar_cast' => true,
254+
'simple_to_complex_string_variable' => true,
255+
'simplified_null_return' => false,
256+
'single_blank_line_at_eof' => true,
257+
'single_class_element_per_statement' => true,
258+
'single_import_per_statement' => true,
259+
'single_line_after_imports' => true,
260+
'single_quote' => true,
261+
'single_space_after_construct' => true,
262+
'single_trait_insert_per_statement' => true,
263+
'space_after_semicolon' => true,
264+
'standardize_increment' => true,
265+
'standardize_not_equals' => true,
266+
'static_lambda' => true,
267+
'strict_param' => true,
268+
'string_line_ending' => true,
269+
'switch_case_semicolon_to_colon' => true,
270+
'switch_case_space' => true,
271+
'switch_continue_to_break' => true,
272+
'ternary_operator_spaces' => true,
273+
'ternary_to_elvis_operator' => true,
274+
'ternary_to_null_coalescing' => true,
275+
'trailing_comma_in_multiline' => [
276+
'elements' => [
277+
'arrays'
278+
]
279+
],
280+
'trim_array_spaces' => true,
281+
'unary_operator_spaces' => true,
282+
'visibility_required' => [
283+
'elements' => [
284+
'const',
285+
'method',
286+
'property',
287+
],
288+
],
289+
'void_return' => true,
290+
'whitespace_after_comma_in_array' => true,
291+
]);
292+
293+
return $config;

β€Ž.php_cs

-49
This file was deleted.

β€Žcomposer.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"require-dev": {
2020
"phpunit/phpunit": "^9.5",
2121
"phpstan/phpstan": "^0.12.85",
22-
"codeception/codeception": "^4.1",
23-
"php-coveralls/php-coveralls": "^2.4"
22+
"codeception/codeception": "^4.1"
2423
},
2524
"autoload": {
2625
"psr-4": {
@@ -49,7 +48,7 @@
4948
"scripts": {
5049
"post-merge": "composer install",
5150
"phpstan": "vendor/bin/phpstan analyse",
52-
"check-style": "php-cs-fixer fix --using-cache=no --diff --config=.php_cs --dry-run --ansi",
51+
"check-style": "php-cs-fixer fix --using-cache=no --diff --config=.php-cs-fixer.php --dry-run --ansi",
5352
"fix-style": "php-cs-fixer fix --using-cache=no --config=.php_cs --ansi",
5453
"test": "vendor/bin/phpunit --colors=always --testdox"
5554
},

0 commit comments

Comments
Β (0)