|
| 1 | +<?php |
| 2 | + |
| 3 | +$finder = PhpCsFixer\Finder::create() |
| 4 | + ->in(__DIR__ . '/src') |
| 5 | + ->in(__DIR__ . '/tests'); |
| 6 | +; |
| 7 | + |
| 8 | +$config = new PhpCsFixer\Config(); |
| 9 | +return $config->setRules([ |
| 10 | + '@PSR12' => true, |
| 11 | + 'align_multiline_comment' => [ |
| 12 | + 'comment_type' => 'all_multiline', |
| 13 | + ], |
| 14 | + 'array_indentation' => true, |
| 15 | + 'assign_null_coalescing_to_coalesce_equal' => true, |
| 16 | + 'binary_operator_spaces' => [ |
| 17 | + 'default' => 'single_space', |
| 18 | + ], |
| 19 | + 'cast_spaces' => [ |
| 20 | + 'space' => 'single', |
| 21 | + ], |
| 22 | + 'class_attributes_separation' => [ |
| 23 | + 'elements' => ['const' => 'one', 'method' => 'one', 'property' => 'one', 'trait_import' => 'none', 'case' => 'none'], |
| 24 | + ], |
| 25 | + 'class_reference_name_casing' => true, |
| 26 | + 'clean_namespace' => true, |
| 27 | + 'combine_consecutive_issets' => true, |
| 28 | + 'concat_space' => [ |
| 29 | + 'spacing' => 'one', |
| 30 | + ], |
| 31 | + 'declare_parentheses' => true, |
| 32 | + 'explicit_indirect_variable' => true, |
| 33 | + 'explicit_string_variable' => true, |
| 34 | + 'fully_qualified_strict_types' => true, |
| 35 | + 'type_declaration_spaces' => true, |
| 36 | + 'general_phpdoc_tag_rename' => [ |
| 37 | + 'replacements' => ['inheritDocs' => 'inheritDoc'], |
| 38 | + ], |
| 39 | + 'global_namespace_import' => [ |
| 40 | + 'import_classes' => true, |
| 41 | + 'import_constants' => true, |
| 42 | + 'import_functions' => true, |
| 43 | + ], |
| 44 | + 'heredoc_indentation' => [ |
| 45 | + 'indentation' => 'same_as_start', |
| 46 | + ], |
| 47 | + 'include' => true, |
| 48 | + 'integer_literal_case' => true, |
| 49 | + 'lambda_not_used_import' => true, |
| 50 | + 'linebreak_after_opening_tag' => true, |
| 51 | + 'list_syntax' => [ |
| 52 | + 'syntax' => 'short', |
| 53 | + ], |
| 54 | + 'magic_constant_casing' => true, |
| 55 | + 'magic_method_casing' => true, |
| 56 | + 'method_chaining_indentation' => true, |
| 57 | + 'multiline_comment_opening_closing' => true, |
| 58 | + 'multiline_whitespace_before_semicolons' => [ |
| 59 | + 'strategy' => 'no_multi_line', |
| 60 | + ], |
| 61 | + 'native_function_casing' => true, |
| 62 | + 'native_type_declaration_casing' => true, |
| 63 | + 'no_alias_language_construct_call' => true, |
| 64 | + 'no_alternative_syntax' => true, |
| 65 | + 'no_blank_lines_after_phpdoc' => true, |
| 66 | + 'no_empty_comment' => true, |
| 67 | + 'no_empty_phpdoc' => true, |
| 68 | + 'no_empty_statement' => true, |
| 69 | + 'no_extra_blank_lines' => [ |
| 70 | + 'tokens' => ['extra'], |
| 71 | + ], |
| 72 | + 'no_leading_namespace_whitespace' => true, |
| 73 | + 'no_multiline_whitespace_around_double_arrow' => true, |
| 74 | + 'no_null_property_initialization' => true, |
| 75 | + 'no_short_bool_cast' => true, |
| 76 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 77 | + 'no_spaces_around_offset' => true, |
| 78 | + 'no_superfluous_phpdoc_tags' => [ |
| 79 | + 'allow_mixed' => false, |
| 80 | + 'allow_unused_params' => false, |
| 81 | + 'remove_inheritdoc' => false, |
| 82 | + ], |
| 83 | + 'no_trailing_comma_in_singleline' => [ |
| 84 | + 'elements' => ['arguments', 'array_destructuring', 'array', 'group_import'], |
| 85 | + ], |
| 86 | + 'no_unneeded_control_parentheses' => [ |
| 87 | + 'statements' => [ |
| 88 | + 'break', |
| 89 | + 'clone', |
| 90 | + 'continue', |
| 91 | + 'echo_print', |
| 92 | + 'negative_instanceof', |
| 93 | + 'others', 'return', |
| 94 | + 'switch_case', |
| 95 | + 'yield', |
| 96 | + 'yield_from', |
| 97 | + ], |
| 98 | + ], |
| 99 | + 'no_unneeded_braces' => [ |
| 100 | + 'namespaces' => false, |
| 101 | + ], |
| 102 | + 'no_unneeded_import_alias' => true, |
| 103 | + 'no_unset_cast' => true, |
| 104 | + 'no_unused_imports' => true, |
| 105 | + 'no_useless_concat_operator' => true, |
| 106 | + 'no_useless_else' => true, |
| 107 | + 'no_useless_nullsafe_operator' => true, |
| 108 | + 'no_useless_return' => true, |
| 109 | + 'no_whitespace_before_comma_in_array' => [ |
| 110 | + 'after_heredoc' => false, |
| 111 | + ], |
| 112 | + 'normalize_index_brace' => true, |
| 113 | + 'not_operator_with_successor_space' => true, |
| 114 | + 'nullable_type_declaration_for_default_null_value' => [ |
| 115 | + 'use_nullable_type_declaration' => true, |
| 116 | + ], |
| 117 | + 'object_operator_without_whitespace' => true, |
| 118 | + 'operator_linebreak' => [ |
| 119 | + 'only_booleans' => false, |
| 120 | + 'position' => 'beginning', |
| 121 | + ], |
| 122 | + 'ordered_interfaces' => [ |
| 123 | + 'direction' => 'ascend', |
| 124 | + 'order' => 'alpha', |
| 125 | + ], |
| 126 | + 'php_unit_method_casing' => [ |
| 127 | + 'case' => 'snake_case', |
| 128 | + ], |
| 129 | + 'phpdoc_align' => [ |
| 130 | + 'align' => 'vertical', |
| 131 | + 'tags' => ['method', 'param', 'property', 'property-read', 'property-write', 'return', 'throws', 'type', 'var'], |
| 132 | + ], |
| 133 | + 'phpdoc_annotation_without_dot' => true, |
| 134 | + 'phpdoc_indent' => true, |
| 135 | + 'phpdoc_inline_tag_normalizer' => [ |
| 136 | + 'tags' => ['example', 'id', 'internal', 'inheritdoc', 'inheritdocs', 'link', 'source', 'toc', 'tutorial'], |
| 137 | + ], |
| 138 | + 'phpdoc_line_span' => [ |
| 139 | + 'const' => 'single', |
| 140 | + 'method' => 'single', |
| 141 | + 'property' => 'single', |
| 142 | + ], |
| 143 | + 'phpdoc_no_alias_tag' => [ |
| 144 | + 'replacements' => ['type' => 'var', 'link' => 'see'], |
| 145 | + ], |
| 146 | + 'phpdoc_no_useless_inheritdoc' => true, |
| 147 | + 'phpdoc_order' => [ |
| 148 | + 'order' => ['param', 'return', 'throws'], |
| 149 | + ], |
| 150 | + 'phpdoc_order_by_value' => [ |
| 151 | + 'annotations' => [ |
| 152 | + 'author', |
| 153 | + 'covers', |
| 154 | + 'coversNothing', |
| 155 | + 'dataProvider', |
| 156 | + 'depends', |
| 157 | + 'group', |
| 158 | + 'internal', |
| 159 | + 'method', |
| 160 | + 'mixin', |
| 161 | + 'property', |
| 162 | + 'property-read', |
| 163 | + 'property-write', |
| 164 | + 'requires', |
| 165 | + 'throws', |
| 166 | + 'uses', |
| 167 | + ], |
| 168 | + ], |
| 169 | + 'phpdoc_return_self_reference' => [ |
| 170 | + 'replacements' => [ |
| 171 | + 'this' => 'self', |
| 172 | + '@this' => 'self', |
| 173 | + '$self' => 'self', |
| 174 | + '@self' => 'self', |
| 175 | + '$static' => 'static', |
| 176 | + '@static' => 'static', |
| 177 | + ], |
| 178 | + ], |
| 179 | + 'phpdoc_scalar' => [ |
| 180 | + 'types' => ['boolean', 'callback', 'double', 'integer', 'real', 'str'], |
| 181 | + ], |
| 182 | + 'phpdoc_separation' => true, |
| 183 | + 'phpdoc_single_line_var_spacing' => true, |
| 184 | + 'phpdoc_summary' => true, |
| 185 | + 'phpdoc_tag_casing' => [ |
| 186 | + 'tags' => ['inheritDoc'], |
| 187 | + ], |
| 188 | + 'phpdoc_tag_type' => true, |
| 189 | + 'phpdoc_to_comment' => [ |
| 190 | + 'ignored_tags' => ['var'], |
| 191 | + ], |
| 192 | + 'phpdoc_trim' => true, |
| 193 | + 'phpdoc_trim_consecutive_blank_line_separation' => true, |
| 194 | + 'phpdoc_types' => [ |
| 195 | + 'groups' => ['alias', 'meta', 'simple'], |
| 196 | + ], |
| 197 | + 'phpdoc_var_annotation_correct_order' => true, |
| 198 | + 'phpdoc_var_without_name' => true, |
| 199 | + 'protected_to_private' => true, |
| 200 | + 'return_assignment' => true, |
| 201 | + 'self_static_accessor' => true, |
| 202 | + 'semicolon_after_instruction' => true, |
| 203 | + 'simple_to_complex_string_variable' => true, |
| 204 | + 'simplified_if_return' => true, |
| 205 | + 'simplified_null_return' => true, |
| 206 | + 'single_line_comment_spacing' => true, |
| 207 | + 'single_line_comment_style' => [ |
| 208 | + 'comment_types' => ['asterisk', 'hash'], |
| 209 | + ], |
| 210 | + 'single_quote' => [ |
| 211 | + 'strings_containing_single_quote_chars' => false, |
| 212 | + ], |
| 213 | + 'single_space_around_construct' => true, |
| 214 | + 'space_after_semicolon' => [ |
| 215 | + 'remove_in_empty_for_expressions' => true, |
| 216 | + ], |
| 217 | + 'standardize_increment' => true, |
| 218 | + 'standardize_not_equals' => true, |
| 219 | + 'switch_case_semicolon_to_colon' => true, |
| 220 | + 'switch_continue_to_break' => true, |
| 221 | + 'ternary_to_null_coalescing' => true, |
| 222 | + 'trailing_comma_in_multiline' => true, |
| 223 | + 'trim_array_spaces' => true, |
| 224 | + 'types_spaces' => [ |
| 225 | + 'space' => 'none', |
| 226 | + 'space_multiple_catch' => null, |
| 227 | + ], |
| 228 | + 'unary_operator_spaces' => true, |
| 229 | + 'whitespace_after_comma_in_array' => true, |
| 230 | + 'yoda_style' => [ |
| 231 | + 'always_move_variable' => false, |
| 232 | + 'equal' => false, |
| 233 | + 'identical' => false, |
| 234 | + 'less_and_greater' => false, |
| 235 | + ], |
| 236 | + ]) |
| 237 | + ->setFinder($finder) |
| 238 | +; |
0 commit comments