-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php-cs-fixer.php
134 lines (132 loc) · 4.29 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
<?php
declare(strict_types=1);
return (new PhpCsFixer\Config())
->setRules([
'@PHP81Migration' => true,
'@PHP80Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'array_indentation' => true,
'binary_operator_spaces' => [
'operators' => [
'=>' => 'align_single_space',
],
],
'concat_space' => [
'spacing' => 'one',
],
'fopen_flags' => false,
'protected_to_private' => false,
'native_function_invocation' => true,
'native_constant_invocation' => true,
'combine_nested_dirname' => true,
'single_quote' => true,
'single_space_around_construct' => [
'constructs_followed_by_a_single_space' => [
'abstract',
'as',
'attribute',
'break',
'case',
'catch',
'class',
'clone',
'comment',
'const',
'const_import',
'continue',
'do',
'echo',
'else',
'elseif',
'enum',
'extends',
'final',
'finally',
'for',
'foreach',
'function',
'function_import',
'global',
'goto',
'if',
'implements',
'include',
'include_once',
'instanceof',
'insteadof',
'interface',
'match',
'named_argument',
// 'namespace', // 兼容性移除
'new',
'open_tag_with_echo',
'php_doc',
'php_open',
'print',
'private',
'protected',
'public',
'readonly',
'require',
'require_once',
'return',
'static',
'switch',
'throw',
'trait',
'try',
'type_colon',
'use',
'use_lambda',
'use_trait',
'var',
'while',
'yield',
'yield_from',
],
],
'control_structure_continuation_position' => [
'position' => 'next_line',
],
'single_line_comment_style' => false,
'phpdoc_to_comment' => false,
'declare_strict_types' => true,
'heredoc_indentation' => [
'indentation' => 'same_as_start',
],
'no_trailing_whitespace_in_string' => false,
'static_lambda' => true,
'modernize_strpos' => true,
'regular_callable_call' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'explicit_indirect_variable' => true,
'no_useless_return' => true,
'return_assignment' => true,
'explicit_string_variable' => true,
'heredoc_to_nowdoc' => true,
// Symfony 冲突
'braces_position' => [
'control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end',
],
'nullable_type_declaration_for_default_null_value' => false,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
'allow_unused_params' => false,
],
'no_null_property_initialization' => false,
])
->setRiskyAllowed(true)
->setFinder(
PhpCsFixer\Finder::create()
->in([
'src',
])
->notPath('tests/Stub')
->notPath('tests/StubAttribute')
->notPath('tests/AttributeRewriteTest.php')
->notPath('tests/CodeRewriteTest.php')
)
;