|
| 1 | +<?php |
| 2 | + |
| 3 | +$files = PhpCsFixer\Finder::create() |
| 4 | + ->in([__DIR__ . '/src']); |
| 5 | + |
| 6 | +return (new PhpCsFixer\Config()) |
| 7 | + ->setRules([ |
| 8 | + '@PER-CS2.0' => true, |
| 9 | + '@PER-CS2.0:risky' => true, |
| 10 | + 'strict_param' => true, |
| 11 | + 'align_multiline_comment' => true, |
| 12 | + 'array_syntax' => [ |
| 13 | + 'syntax' => 'short', |
| 14 | + ], |
| 15 | + 'backtick_to_shell_exec' => true, |
| 16 | + 'binary_operator_spaces' => true, |
| 17 | + 'blank_line_before_statement' => [ |
| 18 | + 'statements' => [ |
| 19 | + 'return', |
| 20 | + ], |
| 21 | + ], |
| 22 | + 'braces_position' => [ |
| 23 | + 'allow_single_line_anonymous_functions' => true, |
| 24 | + 'allow_single_line_empty_anonymous_classes' => true, |
| 25 | + ], |
| 26 | + 'class_attributes_separation' => [ |
| 27 | + 'elements' => [ |
| 28 | + 'method' => 'one', |
| 29 | + ], |
| 30 | + ], |
| 31 | + 'class_reference_name_casing' => true, |
| 32 | + 'clean_namespace' => true, |
| 33 | + 'declare_parentheses' => true, |
| 34 | + 'echo_tag_syntax' => true, |
| 35 | + 'empty_loop_body' => ['style' => 'braces'], |
| 36 | + 'empty_loop_condition' => true, |
| 37 | + 'fully_qualified_strict_types' => true, |
| 38 | + 'general_phpdoc_tag_rename' => [ |
| 39 | + 'replacements' => [ |
| 40 | + 'inheritDocs' => 'inheritDoc', |
| 41 | + ], |
| 42 | + ], |
| 43 | + 'global_namespace_import' => [ |
| 44 | + 'import_classes' => false, |
| 45 | + 'import_constants' => false, |
| 46 | + 'import_functions' => false, |
| 47 | + ], |
| 48 | + 'include' => true, |
| 49 | + 'increment_style' => true, |
| 50 | + 'integer_literal_case' => true, |
| 51 | + 'lambda_not_used_import' => true, |
| 52 | + 'linebreak_after_opening_tag' => true, |
| 53 | + 'magic_constant_casing' => true, |
| 54 | + 'magic_method_casing' => true, |
| 55 | + 'native_function_casing' => true, |
| 56 | + 'native_type_declaration_casing' => true, |
| 57 | + 'no_alias_language_construct_call' => true, |
| 58 | + 'no_alternative_syntax' => true, |
| 59 | + 'no_binary_string' => true, |
| 60 | + 'no_blank_lines_after_phpdoc' => true, |
| 61 | + 'no_empty_comment' => true, |
| 62 | + 'no_empty_phpdoc' => true, |
| 63 | + 'no_empty_statement' => true, |
| 64 | + 'no_extra_blank_lines' => [ |
| 65 | + 'tokens' => [ |
| 66 | + 'attribute', |
| 67 | + 'case', |
| 68 | + 'continue', |
| 69 | + 'curly_brace_block', |
| 70 | + 'default', |
| 71 | + 'extra', |
| 72 | + 'parenthesis_brace_block', |
| 73 | + 'square_brace_block', |
| 74 | + 'switch', |
| 75 | + 'throw', |
| 76 | + 'use', |
| 77 | + ], |
| 78 | + ], |
| 79 | + 'no_leading_namespace_whitespace' => true, |
| 80 | + 'no_mixed_echo_print' => true, |
| 81 | + 'no_null_property_initialization' => true, |
| 82 | + 'no_short_bool_cast' => true, |
| 83 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 84 | + 'no_spaces_around_offset' => true, |
| 85 | + 'no_superfluous_phpdoc_tags' => [ |
| 86 | + 'allow_hidden_params' => true, |
| 87 | + 'remove_inheritdoc' => true, |
| 88 | + ], |
| 89 | + 'no_trailing_comma_in_singleline' => true, |
| 90 | + 'no_unneeded_braces' => [ |
| 91 | + 'namespaces' => true, |
| 92 | + ], |
| 93 | + 'no_unneeded_control_parentheses' => [ |
| 94 | + 'statements' => [ |
| 95 | + 'break', |
| 96 | + 'clone', |
| 97 | + 'continue', |
| 98 | + 'echo_print', |
| 99 | + 'others', |
| 100 | + 'return', |
| 101 | + 'switch_case', |
| 102 | + 'yield', |
| 103 | + 'yield_from', |
| 104 | + ], |
| 105 | + ], |
| 106 | + 'no_unneeded_import_alias' => true, |
| 107 | + 'no_unset_cast' => true, |
| 108 | + 'no_unused_imports' => true, |
| 109 | + 'no_useless_concat_operator' => true, |
| 110 | + 'no_useless_nullsafe_operator' => true, |
| 111 | + 'no_whitespace_before_comma_in_array' => true, |
| 112 | + 'normalize_index_brace' => true, |
| 113 | + 'nullable_type_declaration' => true, |
| 114 | + 'nullable_type_declaration_for_default_null_value' => true, |
| 115 | + 'object_operator_without_whitespace' => true, |
| 116 | + 'operator_linebreak' => [ |
| 117 | + 'only_booleans' => true, |
| 118 | + ], |
| 119 | + 'ordered_imports' => [ |
| 120 | + 'imports_order' => [ |
| 121 | + 'class', |
| 122 | + 'function', |
| 123 | + 'const', |
| 124 | + ], |
| 125 | + 'sort_algorithm' => 'alpha', |
| 126 | + ], |
| 127 | + 'ordered_types' => [ |
| 128 | + 'null_adjustment' => 'always_last', |
| 129 | + 'sort_algorithm' => 'none', |
| 130 | + ], |
| 131 | + 'php_unit_fqcn_annotation' => true, |
| 132 | + 'php_unit_method_casing' => true, |
| 133 | + 'phpdoc_align' => false, |
| 134 | + 'phpdoc_annotation_without_dot' => true, |
| 135 | + 'phpdoc_indent' => true, |
| 136 | + 'phpdoc_inline_tag_normalizer' => true, |
| 137 | + 'phpdoc_no_access' => true, |
| 138 | + 'phpdoc_no_alias_tag' => false, |
| 139 | + 'phpdoc_no_package' => true, |
| 140 | + 'phpdoc_no_useless_inheritdoc' => true, |
| 141 | + 'phpdoc_order' => [ |
| 142 | + 'order' => [ |
| 143 | + 'api', |
| 144 | + 'internal', |
| 145 | + 'psalm-internal', |
| 146 | + 'template', |
| 147 | + 'template-extends', |
| 148 | + 'extends', |
| 149 | + 'template-implements', |
| 150 | + 'implements', |
| 151 | + 'property', |
| 152 | + 'property-read', |
| 153 | + 'property-write', |
| 154 | + 'psalm-require-implements', |
| 155 | + 'phpstan-require-implements', |
| 156 | + 'psalm-require-extends', |
| 157 | + 'phpstan-require-extends', |
| 158 | + 'mixin', |
| 159 | + 'readonly', |
| 160 | + 'psalm-readonly', |
| 161 | + 'phpstan-readonly', |
| 162 | + 'param', |
| 163 | + 'return', |
| 164 | + 'throws', |
| 165 | + 'psalm-suppress', |
| 166 | + ], |
| 167 | + ], |
| 168 | + 'phpdoc_return_self_reference' => true, |
| 169 | + 'phpdoc_scalar' => true, |
| 170 | + 'phpdoc_separation' => [ |
| 171 | + 'groups' => [ |
| 172 | + ['api'], |
| 173 | + [ |
| 174 | + 'property', |
| 175 | + 'property-read', |
| 176 | + 'property-write', |
| 177 | + ], |
| 178 | + ['internal', 'psalm-internal', 'phpstan-internal'], |
| 179 | + [ |
| 180 | + 'template', |
| 181 | + 'template-covariant', |
| 182 | + 'template-extends', |
| 183 | + 'extends', |
| 184 | + 'template-implements', |
| 185 | + 'implements', |
| 186 | + 'psalm-require-implements', |
| 187 | + 'phpstan-require-implements', |
| 188 | + 'psalm-require-extends', |
| 189 | + 'phpstan-require-extends', |
| 190 | + ], |
| 191 | + ['psalm-taint-sink', 'param'], |
| 192 | + ['return', 'throws'], |
| 193 | + ['psalm-suppress'], |
| 194 | + ], |
| 195 | + ], |
| 196 | + 'phpdoc_single_line_var_spacing' => true, |
| 197 | + 'phpdoc_tag_type' => [ |
| 198 | + 'tags' => [ |
| 199 | + 'inheritDoc' => 'inline', |
| 200 | + ], |
| 201 | + ], |
| 202 | + 'phpdoc_to_comment' => false, |
| 203 | + 'phpdoc_trim' => true, |
| 204 | + 'phpdoc_trim_consecutive_blank_line_separation' => true, |
| 205 | + 'phpdoc_types' => true, |
| 206 | + 'phpdoc_types_order' => [ |
| 207 | + 'null_adjustment' => 'always_last', |
| 208 | + 'sort_algorithm' => 'none', |
| 209 | + ], |
| 210 | + 'phpdoc_var_without_name' => true, |
| 211 | + 'semicolon_after_instruction' => true, |
| 212 | + 'simple_to_complex_string_variable' => true, |
| 213 | + 'single_class_element_per_statement' => true, |
| 214 | + 'single_import_per_statement' => true, |
| 215 | + 'single_line_comment_spacing' => true, |
| 216 | + 'single_line_comment_style' => [ |
| 217 | + 'comment_types' => [ |
| 218 | + 'hash', |
| 219 | + ], |
| 220 | + ], |
| 221 | + 'single_line_throw' => false, |
| 222 | + 'single_quote' => true, |
| 223 | + 'space_after_semicolon' => [ |
| 224 | + 'remove_in_empty_for_expressions' => true, |
| 225 | + ], |
| 226 | + 'standardize_increment' => true, |
| 227 | + 'standardize_not_equals' => true, |
| 228 | + 'statement_indentation' => [ |
| 229 | + 'stick_comment_to_next_continuous_control_statement' => true, |
| 230 | + ], |
| 231 | + 'switch_continue_to_break' => true, |
| 232 | + 'trailing_comma_in_multiline' => true, |
| 233 | + 'trim_array_spaces' => true, |
| 234 | + 'type_declaration_spaces' => true, |
| 235 | + 'types_spaces' => true, |
| 236 | + 'unary_operator_spaces' => true, |
| 237 | + 'whitespace_after_comma_in_array' => true, |
| 238 | + 'yoda_style' => false, |
| 239 | + ]) |
| 240 | + ->setCacheFile(__DIR__ . '/vendor/.cache.php-cs-fixer') |
| 241 | + ->setFinder($files); |
0 commit comments