Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

Commit 8f18f14

Browse files
authored
chore: update php-cs-fixer to v3.* (#9)
1 parent 6d8e008 commit 8f18f14

File tree

6 files changed

+368
-333
lines changed

6 files changed

+368
-333
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
.php_cs.cache
1+
.php-cs-fixer.cache
22
vendor

.php-cs-fixer.php

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Config;
6+
use PhpCsFixer\Finder;
7+
8+
$rules = [
9+
'array_syntax' => ['syntax' => 'short'],
10+
'binary_operator_spaces' => [
11+
'default' => 'single_space',
12+
'operators' => ['=>' => null],
13+
],
14+
'blank_line_after_namespace' => true,
15+
'blank_line_after_opening_tag' => true,
16+
'blank_line_before_statement' => [
17+
'statements' => [
18+
'break',
19+
'continue',
20+
'declare',
21+
'return',
22+
'throw',
23+
'try',
24+
],
25+
],
26+
'braces' => true,
27+
'cast_spaces' => true,
28+
'class_attributes_separation' => [
29+
'elements' => [
30+
'const' => 'one',
31+
'method' => 'one',
32+
'property' => 'one',
33+
],
34+
],
35+
'class_definition' => true,
36+
'concat_space' => ['spacing' => 'none'],
37+
'constant_case' => ['case' => 'lower'],
38+
'declare_equal_normalize' => true,
39+
'declare_strict_types' => true,
40+
'echo_tag_syntax' => ['format' => 'long'],
41+
'elseif' => true,
42+
'encoding' => true,
43+
'final_internal_class' => true,
44+
'full_opening_tag' => true,
45+
'fully_qualified_strict_types' => true,
46+
'function_declaration' => true,
47+
'function_typehint_space' => true,
48+
'heredoc_to_nowdoc' => true,
49+
'include' => true,
50+
'increment_style' => ['style' => 'post'],
51+
'indentation_type' => true,
52+
'linebreak_after_opening_tag' => true,
53+
'line_ending' => true,
54+
'lowercase_cast' => true,
55+
'lowercase_keywords' => true,
56+
'lowercase_static_reference' => true,
57+
'magic_method_casing' => true,
58+
'magic_constant_casing' => true,
59+
'method_argument_space' => true,
60+
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
61+
'native_function_casing' => true,
62+
'new_with_braces' => true,
63+
'no_alias_functions' => true,
64+
'no_blank_lines_after_class_opening' => true,
65+
'no_blank_lines_after_phpdoc' => true,
66+
'no_closing_tag' => true,
67+
'no_empty_phpdoc' => true,
68+
'no_empty_statement' => true,
69+
'no_extra_blank_lines' => [
70+
'tokens' => [
71+
'extra',
72+
'throw',
73+
'use',
74+
],
75+
],
76+
'no_leading_import_slash' => true,
77+
'no_leading_namespace_whitespace' => true,
78+
'no_mixed_echo_print' => ['use' => 'echo'],
79+
'no_multiline_whitespace_around_double_arrow' => true,
80+
'no_short_bool_cast' => true,
81+
'no_singleline_whitespace_before_semicolons' => true,
82+
'no_spaces_after_function_name' => true,
83+
'no_spaces_around_offset' => [
84+
'positions' => ['inside'],
85+
],
86+
'no_spaces_inside_parenthesis' => true,
87+
'no_trailing_comma_in_list_call' => true,
88+
'no_trailing_comma_in_singleline_array' => true,
89+
'no_trailing_whitespace' => true,
90+
'no_trailing_whitespace_in_comment' => true,
91+
'no_unneeded_control_parentheses' => [
92+
'statements' => [
93+
'break',
94+
'clone',
95+
'continue',
96+
'echo_print',
97+
'return',
98+
'switch_case',
99+
'yield',
100+
],
101+
],
102+
'no_unreachable_default_argument_value' => true,
103+
'no_unused_imports' => true,
104+
'no_useless_else' => true,
105+
'no_useless_return' => true,
106+
'no_whitespace_before_comma_in_array' => true,
107+
'no_whitespace_in_blank_line' => true,
108+
'normalize_index_brace' => true,
109+
'not_operator_with_successor_space' => true,
110+
'object_operator_without_whitespace' => true,
111+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
112+
'php_unit_strict' => true,
113+
'php_unit_test_class_requires_covers' => true,
114+
'phpdoc_add_missing_param_annotation' => true,
115+
'phpdoc_align' => false,
116+
'phpdoc_indent' => true,
117+
'phpdoc_inline_tag_normalizer' => true,
118+
'phpdoc_no_access' => true,
119+
'phpdoc_no_package' => true,
120+
'phpdoc_no_useless_inheritdoc' => true,
121+
'phpdoc_order' => true,
122+
'phpdoc_scalar' => true,
123+
'phpdoc_single_line_var_spacing' => true,
124+
'phpdoc_summary' => true,
125+
'phpdoc_to_comment' => true,
126+
'phpdoc_trim' => true,
127+
'phpdoc_types' => true,
128+
'phpdoc_var_without_name' => true,
129+
'psr_autoloading' => true,
130+
'self_accessor' => true,
131+
'semicolon_after_instruction' => true,
132+
'short_scalar_cast' => true,
133+
'simplified_null_return' => true,
134+
'single_blank_line_at_eof' => true,
135+
'single_blank_line_before_namespace' => true,
136+
'single_class_element_per_statement' => [
137+
'elements' => [
138+
'const',
139+
'property',
140+
],
141+
],
142+
'single_import_per_statement' => true,
143+
'single_line_after_imports' => true,
144+
'single_line_comment_style' => [
145+
'comment_types' => ['hash'],
146+
],
147+
'single_quote' => true,
148+
'single_trait_insert_per_statement' => true,
149+
'space_after_semicolon' => true,
150+
'standardize_not_equals' => true,
151+
'strict_comparison' => true,
152+
'strict_param' => true,
153+
'switch_case_semicolon_to_colon' => true,
154+
'switch_case_space' => true,
155+
'ternary_operator_spaces' => true,
156+
'trailing_comma_in_multiline' => [
157+
'elements' => ['arrays'],
158+
],
159+
'trim_array_spaces' => true,
160+
'unary_operator_spaces' => true,
161+
'visibility_required' => [
162+
'elements' => [
163+
'property',
164+
'method',
165+
'const',
166+
],
167+
],
168+
'whitespace_after_comma_in_array' => true,
169+
];
170+
171+
$finder = Finder::create()
172+
->notPath('bootstrap')
173+
->notPath('storage')
174+
->notPath('vendor')
175+
->in(getcwd())
176+
->name('*.php')
177+
->notName('*.blade.php')
178+
->notName('index.php')
179+
->notName('server.php')
180+
->notName('_ide_helper.php')
181+
->ignoreDotFiles(true)
182+
->ignoreVCS(true);
183+
184+
return (new Config())
185+
->setFinder($finder)
186+
->setRules($rules)
187+
->setRiskyAllowed(true)
188+
->setCacheFile(__DIR__.'/.php-cs-fixer.cache')
189+
->setUsingCache(true);

.php_cs

Lines changed: 0 additions & 145 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"pestphp/pest-plugin-livewire": "^1.0",
1717
"spatie/pest-plugin-snapshots": "^1.1",
1818
"ergebnis/phpstan-rules": "^0.15.3",
19-
"friendsofphp/php-cs-fixer": "^2.16",
19+
"friendsofphp/php-cs-fixer": "^v3.1.0",
2020
"graham-campbell/analyzer": "^3.0",
2121
"johnkary/phpunit-speedtrap": "^4.0",
2222
"mockery/mockery": "^1.4",

0 commit comments

Comments
 (0)