|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * This file is part of coisa/error-handler. |
| 5 | + * |
| 6 | + * (c) Felipe Sayão Lobato Abreu <[email protected]> |
| 7 | + * |
| 8 | + * This source file is subject to the license that is bundled |
| 9 | + * with this source code in the file LICENSE. |
| 10 | + */ |
| 11 | + |
| 12 | +declare(strict_types=1); |
| 13 | + |
| 14 | +$header = <<<'EOF' |
| 15 | +This file is part of coisa/error-handler. |
| 16 | +
|
| 17 | +(c) Felipe Sayão Lobato Abreu <[email protected]> |
| 18 | +
|
| 19 | +This source file is subject to the license that is bundled |
| 20 | +with this source code in the file LICENSE. |
| 21 | +EOF; |
| 22 | + |
| 23 | +$finder = PhpCsFixer\Finder::create() |
| 24 | + ->files() |
| 25 | + ->in([__DIR__]) |
| 26 | + ->name('*.php') |
| 27 | + ->append([__FILE__]) |
| 28 | + ->notPath('vendor/'); |
| 29 | + |
| 30 | +return PhpCsFixer\Config::create() |
| 31 | + ->setRiskyAllowed(true) |
| 32 | + ->setRules([ |
| 33 | + 'align_multiline_comment' => true, |
| 34 | + 'array_syntax' => [ |
| 35 | + 'syntax' => 'short' |
| 36 | + ], |
| 37 | + 'binary_operator_spaces' => [ |
| 38 | + 'align_double_arrow' => true, |
| 39 | + 'align_equals' => true |
| 40 | + ], |
| 41 | + 'blank_line_after_namespace' => true, |
| 42 | + 'blank_line_after_opening_tag' => true, |
| 43 | + 'blank_line_before_statement' => [ |
| 44 | + 'statements' => [ |
| 45 | + 'break', |
| 46 | + 'continue', |
| 47 | + 'declare', |
| 48 | + 'return', |
| 49 | + 'throw', |
| 50 | + 'try', |
| 51 | + 'yield', |
| 52 | + ], |
| 53 | + ], |
| 54 | + 'braces' => true, |
| 55 | + 'cast_spaces' => true, |
| 56 | + 'class_attributes_separation' => [ |
| 57 | + 'elements' => [ |
| 58 | + 'const', |
| 59 | + 'method', |
| 60 | + 'property' |
| 61 | + ] |
| 62 | + ], |
| 63 | + 'class_definition' => [ |
| 64 | + 'multi_line_extends_each_single_line' => false, |
| 65 | + 'single_item_single_line' => false |
| 66 | + ], |
| 67 | + 'class_keyword_remove' => false, |
| 68 | + 'combine_consecutive_issets' => true, |
| 69 | + 'combine_consecutive_unsets' => true, |
| 70 | + 'combine_nested_dirname' => true, |
| 71 | + 'compact_nullable_typehint' => true, |
| 72 | + 'concat_space' => [ |
| 73 | + 'spacing' => 'one' |
| 74 | + ], |
| 75 | + 'date_time_immutable' => false, |
| 76 | + 'declare_equal_normalize' => [ |
| 77 | + 'space' => 'none' |
| 78 | + ], |
| 79 | + 'dir_constant' => true, |
| 80 | + 'declare_strict_types' => true, |
| 81 | + 'elseif' => true, |
| 82 | + 'encoding' => true, |
| 83 | + 'ereg_to_preg' => true, |
| 84 | + 'error_suppression' => [ |
| 85 | + 'mute_deprecation_error' => false, |
| 86 | + 'noise_remaining_usages' => false, |
| 87 | + 'noise_remaining_usages_exclude' => [] |
| 88 | + ], |
| 89 | + 'escape_implicit_backslashes' => [ |
| 90 | + 'double_quoted' => true, |
| 91 | + 'heredoc_syntax' => true, |
| 92 | + 'single_quoted' => false, |
| 93 | + ], |
| 94 | + 'explicit_indirect_variable' => true, |
| 95 | + 'explicit_string_variable' => true, |
| 96 | + 'final_internal_class' => false, |
| 97 | + 'fopen_flag_order' => true, |
| 98 | + 'fopen_flags' => [ |
| 99 | + 'b_mode' => true, |
| 100 | + ], |
| 101 | + 'full_opening_tag' => true, |
| 102 | + 'fully_qualified_strict_types' => true, |
| 103 | + 'function_declaration' => [ |
| 104 | + 'closure_function_spacing' => 'one' |
| 105 | + ], |
| 106 | + 'function_to_constant' => [ |
| 107 | + 'functions' => [ |
| 108 | + 'get_called_class', |
| 109 | + 'get_class', |
| 110 | + 'php_sapi_name', |
| 111 | + 'phpversion', |
| 112 | + 'pi' |
| 113 | + ] |
| 114 | + ], |
| 115 | + 'function_typehint_space' => true, |
| 116 | + 'general_phpdoc_annotation_remove' => [ |
| 117 | + 'annotations' => [ |
| 118 | + 'author' |
| 119 | + ] |
| 120 | + ], |
| 121 | + 'header_comment' => [ |
| 122 | + 'commentType' => 'PHPDoc', |
| 123 | + 'header' => $header, |
| 124 | + 'location' => 'after_open', |
| 125 | + 'separate' => 'both' |
| 126 | + ], |
| 127 | + 'heredoc_indentation' => false, |
| 128 | + 'heredoc_to_nowdoc' => true, |
| 129 | + 'indentation_type' => true, |
| 130 | + 'line_ending' => true, |
| 131 | + 'list_syntax' => [ |
| 132 | + 'syntax' => 'short' |
| 133 | + ], |
| 134 | + 'lowercase_cast' => true, |
| 135 | + 'lowercase_constants' => true, |
| 136 | + 'lowercase_keywords' => true, |
| 137 | + 'magic_constant_casing' => true, |
| 138 | + 'method_argument_space' => [ |
| 139 | + 'ensure_fully_multiline' => true |
| 140 | + ], |
| 141 | + 'modernize_types_casting' => true, |
| 142 | + 'native_function_casing' => true, |
| 143 | + 'native_function_invocation' => true, |
| 144 | + 'no_alias_functions' => true, |
| 145 | + 'no_blank_lines_after_class_opening' => true, |
| 146 | + 'no_blank_lines_after_phpdoc' => true, |
| 147 | + 'no_closing_tag' => true, |
| 148 | + 'no_empty_comment' => true, |
| 149 | + 'no_empty_phpdoc' => true, |
| 150 | + 'no_empty_statement' => true, |
| 151 | + 'no_extra_consecutive_blank_lines' => true, |
| 152 | + 'no_homoglyph_names' => true, |
| 153 | + 'no_leading_import_slash' => true, |
| 154 | + 'no_leading_namespace_whitespace' => true, |
| 155 | + 'no_mixed_echo_print' => [ |
| 156 | + 'use' => 'echo' |
| 157 | + ], |
| 158 | + 'no_null_property_initialization' => true, |
| 159 | + 'no_short_bool_cast' => true, |
| 160 | + 'no_short_echo_tag' => true, |
| 161 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 162 | + 'no_spaces_after_function_name' => true, |
| 163 | + 'no_spaces_inside_parenthesis' => true, |
| 164 | + 'no_superfluous_elseif' => true, |
| 165 | + 'no_trailing_comma_in_list_call' => true, |
| 166 | + 'no_trailing_comma_in_singleline_array' => true, |
| 167 | + 'no_trailing_whitespace' => true, |
| 168 | + 'no_trailing_whitespace_in_comment' => true, |
| 169 | + 'no_unneeded_control_parentheses' => true, |
| 170 | + 'no_unneeded_curly_braces' => true, |
| 171 | + 'no_unneeded_final_method' => true, |
| 172 | + 'no_unreachable_default_argument_value' => true, |
| 173 | + 'no_unused_imports' => true, |
| 174 | + 'no_useless_else' => true, |
| 175 | + 'no_whitespace_before_comma_in_array' => true, |
| 176 | + 'no_whitespace_in_blank_line' => true, |
| 177 | + 'non_printable_character' => true, |
| 178 | + 'normalize_index_brace' => true, |
| 179 | + 'object_operator_without_whitespace' => true, |
| 180 | + 'ordered_class_elements' => [ |
| 181 | + 'order' => [ |
| 182 | + 'use_trait', |
| 183 | + 'constant_public', |
| 184 | + 'constant_protected', |
| 185 | + 'constant_private', |
| 186 | + 'property_public', |
| 187 | + 'property_protected', |
| 188 | + 'property_private', |
| 189 | + 'construct', |
| 190 | + 'destruct', |
| 191 | + 'magic', |
| 192 | + 'phpunit', |
| 193 | + 'method_public', |
| 194 | + 'method_protected', |
| 195 | + 'method_private', |
| 196 | + ], |
| 197 | + ], |
| 198 | + 'ordered_imports' => true, |
| 199 | + 'phpdoc_add_missing_param_annotation' => true, |
| 200 | + 'phpdoc_align' => true, |
| 201 | + 'phpdoc_annotation_without_dot' => true, |
| 202 | + 'phpdoc_indent' => true, |
| 203 | + 'phpdoc_no_access' => true, |
| 204 | + 'phpdoc_no_empty_return' => true, |
| 205 | + 'phpdoc_no_package' => false, |
| 206 | + 'phpdoc_order' => true, |
| 207 | + 'phpdoc_return_self_reference' => true, |
| 208 | + 'phpdoc_scalar' => true, |
| 209 | + 'phpdoc_separation' => true, |
| 210 | + 'phpdoc_single_line_var_spacing' => true, |
| 211 | + 'phpdoc_to_comment' => true, |
| 212 | + 'phpdoc_trim' => true, |
| 213 | + 'phpdoc_types' => true, |
| 214 | + 'phpdoc_types_order' => true, |
| 215 | + 'phpdoc_var_without_name' => true, |
| 216 | + 'pow_to_exponentiation' => true, |
| 217 | + 'protected_to_private' => true, |
| 218 | + 'return_type_declaration' => [ |
| 219 | + 'space_before' => 'none' |
| 220 | + ], |
| 221 | + 'self_accessor' => true, |
| 222 | + 'short_scalar_cast' => true, |
| 223 | + 'simplified_null_return' => true, |
| 224 | + 'single_blank_line_at_eof' => true, |
| 225 | + 'single_import_per_statement' => true, |
| 226 | + 'single_line_after_imports' => true, |
| 227 | + 'single_quote' => true, |
| 228 | + 'standardize_not_equals' => true, |
| 229 | + 'ternary_to_null_coalescing' => true, |
| 230 | + 'trim_array_spaces' => true, |
| 231 | + 'unary_operator_spaces' => true, |
| 232 | + 'visibility_required' => true, |
| 233 | + 'void_return' => true, |
| 234 | + 'whitespace_after_comma_in_array' => true, |
| 235 | + ]) |
| 236 | + ->setFinder($finder); |
0 commit comments