|
13 | 13 | use PhpCsFixer\Config; |
14 | 14 | use PhpCsFixer\Finder; |
15 | 15 |
|
16 | | -$header = <<<EOF |
17 | | -This file is part of the guanguans/laravel-code-runner. |
| 16 | +$header = <<<'header' |
| 17 | + This file is part of the guanguans/laravel-code-runner. |
18 | 18 |
|
19 | | -(c) guanguans <ityaozm@gmail.com> |
| 19 | + (c) guanguans <ityaozm@gmail.com> |
20 | 20 |
|
21 | | -This source file is subject to the MIT license that is bundled. |
22 | | -EOF; |
| 21 | + This source file is subject to the MIT license that is bundled. |
| 22 | + header; |
23 | 23 |
|
24 | 24 | /** @noinspection PhpParamsInspection */ |
25 | 25 | $finder = Finder::create() |
|
33 | 33 | ->append([ |
34 | 34 | __DIR__.'/.php-cs-fixer.php', |
35 | 35 | __DIR__.'/rector.php', |
| 36 | + __DIR__.'/tests.php', |
36 | 37 | ]) |
37 | 38 | ->exclude([ |
38 | 39 | '.github/', |
|
52 | 53 | ->ignoreVCS(true); |
53 | 54 |
|
54 | 55 | return (new Config()) |
| 56 | + ->setFinder($finder) |
| 57 | + ->setRiskyAllowed(true) |
| 58 | + ->setUsingCache(false) |
| 59 | + ->setCacheFile(__DIR__.'/build/.php-cs-fixer.cache') |
55 | 60 | ->setRules([ |
56 | | - '@DoctrineAnnotation' => true, |
57 | | - '@PHP80Migration:risky' => true, |
| 61 | + // '@PHP70Migration' => true, |
| 62 | + // '@PHP70Migration:risky' => true, |
| 63 | + // '@PHP71Migration' => true, |
| 64 | + // '@PHP71Migration:risky' => true, |
| 65 | + // '@PHP73Migration' => true, |
| 66 | + '@PHP74Migration' => true, |
| 67 | + '@PHP74Migration:risky' => true, |
| 68 | + // '@PHP80Migration' => true, |
| 69 | + // '@PHP80Migration:risky' => true, |
| 70 | + // '@PHP81Migration' => true, |
| 71 | + // '@PHP82Migration' => true, |
| 72 | + |
| 73 | + // '@PHPUnit75Migration:risky' => true, |
58 | 74 | '@PHPUnit84Migration:risky' => true, |
59 | | - '@PSR12:risky' => true, |
60 | | - '@Symfony' => true, |
| 75 | + // '@PHPUnit100Migration:risky' => true, |
| 76 | + |
| 77 | + // '@DoctrineAnnotation' => true, |
| 78 | + '@PhpCsFixer' => true, |
| 79 | + '@PhpCsFixer:risky' => true, |
| 80 | + |
| 81 | + // alias |
| 82 | + 'mb_str_functions' => true, |
| 83 | + |
| 84 | + // array_notation |
| 85 | + |
| 86 | + // basic |
| 87 | + 'curly_braces_position' => [ |
| 88 | + 'control_structures_opening_brace' => 'same_line', |
| 89 | + 'functions_opening_brace' => 'next_line_unless_newline_at_signature_end', |
| 90 | + 'anonymous_functions_opening_brace' => 'same_line', |
| 91 | + 'classes_opening_brace' => 'next_line_unless_newline_at_signature_end', |
| 92 | + 'anonymous_classes_opening_brace' => 'same_line', |
| 93 | + 'allow_single_line_empty_anonymous_classes' => true, |
| 94 | + 'allow_single_line_anonymous_functions' => true, |
| 95 | + ], |
| 96 | + 'no_multiple_statements_per_line' => true, |
| 97 | + |
| 98 | + // casing |
| 99 | + // cast_notation |
| 100 | + |
| 101 | + // class_notation |
| 102 | + 'final_class' => false, |
| 103 | + 'final_internal_class' => false, |
| 104 | + 'final_public_method_for_abstract_class' => true, |
| 105 | + 'ordered_class_elements' => [ |
| 106 | + 'order' => [ |
| 107 | + 'use_trait', |
| 108 | + 'case', |
| 109 | + |
| 110 | + 'constant_public', |
| 111 | + 'constant_protected', |
| 112 | + 'constant_private', |
| 113 | + |
| 114 | + 'property_public', |
| 115 | + 'property_protected', |
| 116 | + 'property_private', |
| 117 | + |
| 118 | + 'construct', |
| 119 | + 'destruct', |
| 120 | + 'magic', |
| 121 | + 'phpunit', |
| 122 | + |
| 123 | + 'method_public', |
| 124 | + 'method_protected', |
| 125 | + 'method_private', |
| 126 | + ], |
| 127 | + 'sort_algorithm' => 'none', |
| 128 | + ], |
| 129 | + 'ordered_interfaces' => [ |
| 130 | + 'order' => 'alpha', |
| 131 | + 'direction' => 'ascend', |
| 132 | + ], |
| 133 | + 'self_static_accessor' => true, |
| 134 | + |
| 135 | + // class_usage |
| 136 | + 'date_time_immutable' => true, |
| 137 | + |
| 138 | + // comment |
61 | 139 | 'header_comment' => [ |
62 | 140 | 'header' => $header, |
63 | 141 | 'comment_type' => 'PHPDoc', |
| 142 | + 'location' => 'after_declare_strict', |
| 143 | + 'separate' => 'both', |
64 | 144 | ], |
65 | | - 'blank_line_before_statement' => [ |
66 | | - 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], |
| 145 | + |
| 146 | + // constant_notation |
| 147 | + |
| 148 | + // control_structure |
| 149 | + 'control_structure_braces' => true, |
| 150 | + 'control_structure_continuation_position' => [ |
| 151 | + // 'position' => 'same_line', |
67 | 152 | ], |
68 | | - 'comment_to_phpdoc' => [ |
69 | | - 'ignored_tags' => [], |
| 153 | + 'empty_loop_condition' => [ |
| 154 | + // 'style' => 'for', |
70 | 155 | ], |
71 | | - 'declare_strict_types' => true, |
72 | | - 'method_argument_space' => [ |
73 | | - 'on_multiline' => 'ensure_fully_multiline', |
| 156 | + 'simplified_if_return' => true, |
| 157 | + |
| 158 | + // doctrine_annotation |
| 159 | + |
| 160 | + // function_notation |
| 161 | + 'date_time_create_from_format_call' => true, |
| 162 | + 'nullable_type_declaration_for_default_null_value' => [ |
| 163 | + 'use_nullable_type_declaration' => true, |
| 164 | + ], |
| 165 | + 'phpdoc_to_param_type' => [ |
| 166 | + 'scalar_types' => true, |
| 167 | + ], |
| 168 | + // 'phpdoc_to_property_type' => [ |
| 169 | + // 'scalar_types' => true, |
| 170 | + // ], |
| 171 | + 'phpdoc_to_return_type' => [ |
| 172 | + 'scalar_types' => true, |
| 173 | + ], |
| 174 | + 'regular_callable_call' => true, |
| 175 | + 'single_line_throw' => false, |
| 176 | + // 'static_lambda' => true, |
| 177 | + |
| 178 | + // import |
| 179 | + 'group_import' => false, |
| 180 | + |
| 181 | + // language_construct |
| 182 | + 'declare_parentheses' => true, |
| 183 | + |
| 184 | + // list_notation |
| 185 | + |
| 186 | + // namespace_notation |
| 187 | + 'no_blank_lines_before_namespace' => false, |
| 188 | + |
| 189 | + // naming |
| 190 | + |
| 191 | + // operator |
| 192 | + 'no_useless_concat_operator' => [ |
| 193 | + 'juggle_simple_strings' => true, |
74 | 194 | ], |
75 | 195 | 'not_operator_with_successor_space' => true, |
76 | | - 'no_useless_return' => true, |
77 | | - 'no_useless_else' => true, |
78 | | - 'is_null' => true, |
79 | | - 'return_assignment' => true, |
80 | | - 'multiline_comment_opening_closing' => true, |
81 | | - 'align_multiline_comment' => [ |
82 | | - 'comment_type' => 'phpdocs_only', |
83 | | - ], |
84 | | - 'phpdoc_to_comment' => [], |
85 | | - 'phpdoc_var_annotation_correct_order' => true, |
86 | | - 'php_unit_construct' => [ |
87 | | - 'assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame'], |
88 | | - ], |
89 | | - 'array_indentation' => true, |
90 | | - 'method_chaining_indentation' => true, |
| 196 | + |
| 197 | + // php_tag |
| 198 | + |
| 199 | + // php_unit |
| 200 | + 'php_unit_size_class' => [ |
| 201 | + 'group' => 'small', |
| 202 | + ], |
| 203 | + 'php_unit_test_case_static_method_calls' => [ |
| 204 | + 'call_type' => 'this', |
| 205 | + 'methods' => [], |
| 206 | + ], |
| 207 | + |
| 208 | + // phpdoc |
| 209 | + 'general_phpdoc_annotation_remove' => [ |
| 210 | + 'annotations' => [ |
| 211 | + 'package', |
| 212 | + 'subpackage', |
| 213 | + ], |
| 214 | + 'case_sensitive' => false, |
| 215 | + ], |
| 216 | + 'phpdoc_line_span' => [ |
| 217 | + 'const' => null, |
| 218 | + 'property' => null, |
| 219 | + 'method' => 'multi', |
| 220 | + ], |
| 221 | + 'phpdoc_no_empty_return' => false, |
| 222 | + 'phpdoc_summary' => false, |
| 223 | + 'phpdoc_tag_casing' => [ |
| 224 | + 'tags' => [ |
| 225 | + 'inheritDoc', |
| 226 | + ], |
| 227 | + ], |
| 228 | + 'phpdoc_to_comment' => [ |
| 229 | + // 'ignored_tags' => [], |
| 230 | + ], |
| 231 | + |
| 232 | + // return_notation |
| 233 | + 'simplified_null_return' => true, |
| 234 | + |
| 235 | + // semicolon |
| 236 | + 'multiline_whitespace_before_semicolons' => [ |
| 237 | + 'strategy' => 'no_multi_line', |
| 238 | + ], |
| 239 | + |
| 240 | + // strict |
| 241 | + 'declare_strict_types' => true, |
| 242 | + |
| 243 | + // string_notation |
| 244 | + 'explicit_string_variable' => false, |
| 245 | + |
| 246 | + // whitespace |
| 247 | + 'blank_line_before_statement' => [ |
| 248 | + 'statements' => [ |
| 249 | + 'break', |
| 250 | + 'case', |
| 251 | + 'continue', |
| 252 | + 'declare', |
| 253 | + 'default', |
| 254 | + 'exit', |
| 255 | + 'goto', |
| 256 | + 'include', |
| 257 | + 'include_once', |
| 258 | + 'phpdoc', |
| 259 | + 'require', |
| 260 | + 'require_once', |
| 261 | + 'return', |
| 262 | + 'switch', |
| 263 | + 'throw', |
| 264 | + 'try', |
| 265 | + 'yield', |
| 266 | + 'yield_from', |
| 267 | + ], |
| 268 | + ], |
91 | 269 | 'statement_indentation' => true, |
92 | | - ]) |
93 | | - ->setRiskyAllowed(true) |
94 | | - ->setFinder($finder); |
| 270 | + ]); |
0 commit comments