|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types = 1); |
| 4 | + |
| 5 | +use PhpCsFixer\Config; |
| 6 | +use PhpCsFixer\Finder; |
| 7 | + |
| 8 | +$finder = Finder::create()->in(__DIR__); |
| 9 | + |
| 10 | +return Config::create() |
| 11 | + ->setUsingCache(false) |
| 12 | + ->setFinder($finder) |
| 13 | + ->setRules([ |
| 14 | + "@PSR2" => true, |
| 15 | + "align_multiline_comment" => [ |
| 16 | + "comment_type" => "phpdocs_like", |
| 17 | + ], |
| 18 | + "array_indentation" => true, |
| 19 | + "array_syntax" => [ |
| 20 | + "syntax" => "short", |
| 21 | + ], |
| 22 | + "blank_line_after_opening_tag" => true, |
| 23 | + "blank_line_before_statement" => true, |
| 24 | + "cast_spaces" => [ |
| 25 | + "space" => "single", |
| 26 | + ], |
| 27 | + "class_attributes_separation" => [ |
| 28 | + "elements" => ["const", "method", "property"], |
| 29 | + ], |
| 30 | + "combine_consecutive_issets" => true, |
| 31 | + "combine_consecutive_unsets" => true, |
| 32 | + "compact_nullable_typehint" => true, |
| 33 | + "concat_space" => [ |
| 34 | + "spacing" => "one", |
| 35 | + ], |
| 36 | + "declare_equal_normalize" => [ |
| 37 | + "space" => "single", |
| 38 | + ], |
| 39 | + "declare_strict_types" => true, |
| 40 | + "dir_constant" => true, |
| 41 | + "ereg_to_preg" => true, |
| 42 | + "explicit_indirect_variable" => true, |
| 43 | + "fopen_flag_order" => true, |
| 44 | + "function_to_constant" => [ |
| 45 | + "functions" => ["get_class", "php_sapi_name", "phpversion", "pi"], |
| 46 | + ], |
| 47 | + "function_typehint_space" => true, |
| 48 | + "global_namespace_import" => [ |
| 49 | + "import_classes" => true, |
| 50 | + "import_constants" => true, |
| 51 | + "import_functions" => true, |
| 52 | + ], |
| 53 | + "implode_call" => true, |
| 54 | + "include" => true, |
| 55 | + "increment_style" => [ |
| 56 | + "style" => "post", |
| 57 | + ], |
| 58 | + "is_null" => [ |
| 59 | + "use_yoda_style" => false, |
| 60 | + ], |
| 61 | + "linebreak_after_opening_tag" => true, |
| 62 | + "list_syntax" => [ |
| 63 | + "syntax" => "short", |
| 64 | + ], |
| 65 | + "logical_operators" => true, |
| 66 | + "lowercase_cast" => true, |
| 67 | + "lowercase_static_reference" => true, |
| 68 | + "magic_constant_casing" => true, |
| 69 | + "magic_method_casing" => true, |
| 70 | + "mb_str_functions" => true, |
| 71 | + "method_chaining_indentation" => true, |
| 72 | + "modernize_types_casting" => true, |
| 73 | + "modernize_types_casting" => true, |
| 74 | + "multiline_whitespace_before_semicolons" => [ |
| 75 | + "strategy" => "no_multi_line", |
| 76 | + ], |
| 77 | + "native_function_casing" => true, |
| 78 | + "native_function_type_declaration_casing" => true, |
| 79 | + "new_with_braces" => true, |
| 80 | + "no_alternative_syntax" => true, |
| 81 | + "no_binary_string" => true, |
| 82 | + "no_blank_lines_after_class_opening" => true, |
| 83 | + "no_blank_lines_after_phpdoc" => true, |
| 84 | + "no_empty_comment" => true, |
| 85 | + "no_empty_phpdoc" => true, |
| 86 | + "no_empty_statement" => true, |
| 87 | + "no_extra_blank_lines" => [ |
| 88 | + "tokens" => ["break", "case", "continue", "curly_brace_block", "default", "extra", "parenthesis_brace_block", "return", "square_brace_block", "switch", "throw", "use", "useTrait", "use_trait"], |
| 89 | + ], |
| 90 | + "no_homoglyph_names" => true, |
| 91 | + "no_leading_import_slash" => true, |
| 92 | + "no_leading_namespace_whitespace" => true, |
| 93 | + "no_mixed_echo_print" => [ |
| 94 | + "use" => "echo", |
| 95 | + ], |
| 96 | + "no_multiline_whitespace_around_double_arrow" => true, |
| 97 | + "no_null_property_initialization" => true, |
| 98 | + "no_php4_constructor" => true, |
| 99 | + "no_short_bool_cast" => true, |
| 100 | + "no_short_echo_tag" => true, |
| 101 | + "no_singleline_whitespace_before_semicolons" => true, |
| 102 | + "no_spaces_around_offset" => true, |
| 103 | + "no_superfluous_elseif" => true, |
| 104 | + "no_superfluous_phpdoc_tags" => [ |
| 105 | + "allow_mixed" => false, |
| 106 | + "allow_unused_params" => false, |
| 107 | + "remove_inheritdoc" => false, |
| 108 | + ], |
| 109 | + "no_trailing_comma_in_list_call" => true, |
| 110 | + "no_trailing_comma_in_singleline_array" => true, |
| 111 | + "no_unneeded_control_parentheses" => [ |
| 112 | + "statements" => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield'], |
| 113 | + ], |
| 114 | + "no_unneeded_curly_braces" => [ |
| 115 | + "namespaces" => true, |
| 116 | + ], |
| 117 | + "no_unneeded_final_method" => true, |
| 118 | + "no_unreachable_default_argument_value" => true, |
| 119 | + "no_unset_cast" => true, |
| 120 | + "no_unset_on_property" => true, |
| 121 | + "no_unused_imports" => true, |
| 122 | + "no_useless_else" => true, |
| 123 | + "no_useless_return" => true, |
| 124 | + "no_whitespace_before_comma_in_array" => [ |
| 125 | + "after_heredoc" => false, |
| 126 | + ], |
| 127 | + "no_whitespace_in_blank_line" => true, |
| 128 | + "non_printable_character" => [ |
| 129 | + "use_escape_sequences_in_strings" => false, |
| 130 | + ], |
| 131 | + "normalize_index_brace" => true, |
| 132 | + "object_operator_without_whitespace" => true, |
| 133 | + "ordered_class_elements" => [ |
| 134 | + "order" => ['use_trait', 'constant_public', 'constant_protected', 'constant_private', 'property_public', 'property_protected', 'property_private', 'construct', 'destruct', 'magic', 'phpunit', 'method_public', 'method_protected', 'method_private'], |
| 135 | + "sortAlgorithm" => "alpha", |
| 136 | + ], |
| 137 | + "ordered_interfaces" => [ |
| 138 | + "direction" => "ascend", |
| 139 | + "order" => "alpha", |
| 140 | + ], |
| 141 | + "phpdoc_add_missing_param_annotation" => [ |
| 142 | + "only_untyped" => true, |
| 143 | + ], |
| 144 | + "phpdoc_align" => [ |
| 145 | + "align" => "vertical", |
| 146 | + "tags" => ['param', 'return', 'throws', 'type', 'var'], |
| 147 | + ], |
| 148 | + "phpdoc_indent" => true, |
| 149 | + "phpdoc_no_empty_return" => true, |
| 150 | + "phpdoc_order" => true, |
| 151 | + "phpdoc_scalar" => [ |
| 152 | + "types" => ['boolean', 'double', 'integer', 'real', 'str'], |
| 153 | + ], |
| 154 | + "phpdoc_separation" => true, |
| 155 | + "phpdoc_single_line_var_spacing" => true, |
| 156 | + "phpdoc_to_comment" => true, |
| 157 | + "phpdoc_trim" => true, |
| 158 | + "phpdoc_trim_consecutive_blank_line_separation" => true, |
| 159 | + "phpdoc_types" => [ |
| 160 | + "groups" => ['simple', 'alias', 'meta'], |
| 161 | + ], |
| 162 | + "phpdoc_types_order" => [ |
| 163 | + "null_adjustment" => "always_first", |
| 164 | + "sort_algorithm" => "alpha", |
| 165 | + ], |
| 166 | + "phpdoc_var_annotation_correct_order" => true, |
| 167 | + "phpdoc_var_without_name" => true, |
| 168 | + "pow_to_exponentiation" => true, |
| 169 | + "protected_to_private" => true, |
| 170 | + "psr4" => true, |
| 171 | + "random_api_migration" => [ |
| 172 | + "replacements" => ['getrandmax' => 'mt_getrandmax', 'rand' => 'mt_rand', 'srand' => 'mt_srand'], |
| 173 | + ], |
| 174 | + "return_assignment" => true, |
| 175 | + "return_type_declaration" => [ |
| 176 | + "space_before" => "none", |
| 177 | + ], |
| 178 | + "self_accessor" => true, |
| 179 | + "self_static_accessor" => true, |
| 180 | + "semicolon_after_instruction" => true, |
| 181 | + "set_type_to_cast" => true, |
| 182 | + "short_scalar_cast" => true, |
| 183 | + "simple_to_complex_string_variable" => true, |
| 184 | + "simplified_null_return" => true, |
| 185 | + "single_blank_line_before_namespace" => true, |
| 186 | + "single_class_element_per_statement" => [ |
| 187 | + "elements" => ['const', 'property'], |
| 188 | + ], |
| 189 | + "single_line_comment_style" => [ |
| 190 | + "comment_types" => ['asterisk', 'hash'], |
| 191 | + ], |
| 192 | + "single_line_throw" => true, |
| 193 | + "single_trait_insert_per_statement" => true, |
| 194 | + "space_after_semicolon" => [ |
| 195 | + "remove_in_empty_for_expressions" => false, |
| 196 | + ], |
| 197 | + "standardize_increment" => true, |
| 198 | + "standardize_not_equals" => true, |
| 199 | + "strict_param" => true, |
| 200 | + "switch_case_semicolon_to_colon" => true, |
| 201 | + "switch_case_space" => true, |
| 202 | + "ternary_operator_spaces" => true, |
| 203 | + "ternary_to_null_coalescing" => true, |
| 204 | + "trailing_comma_in_multiline_array" => [ |
| 205 | + "after_heredoc" => false, |
| 206 | + ], |
| 207 | + "trim_array_spaces" => true, |
| 208 | + "unary_operator_spaces" => true, |
| 209 | + "visibility_required" => [ |
| 210 | + "elements" => ['property', 'method'], |
| 211 | + ], |
| 212 | + "void_return" => true, |
| 213 | + "whitespace_after_comma_in_array" => true, |
| 214 | + ]); |
0 commit comments