|
| 1 | +<?php |
| 2 | + |
| 3 | +$finder = PhpCsFixer\Finder::create() |
| 4 | + ->files() |
| 5 | + ->in(__DIR__ . '/src') |
| 6 | +// ->in(__DIR__ . '/test') |
| 7 | + ->name('*.php'); |
| 8 | + |
| 9 | + |
| 10 | +return (new PhpCsFixer\Config) |
| 11 | + ->setUsingCache(true) |
| 12 | + ->setIndent("\t") |
| 13 | + ->setLineEnding("\n") |
| 14 | + //->setUsingLinter(false) |
| 15 | + ->setRiskyAllowed(true) |
| 16 | + ->setRules( |
| 17 | + [ |
| 18 | + '@PHPUnit60Migration:risky' => true, |
| 19 | + 'concat_space' => [ |
| 20 | + 'spacing' => 'one', |
| 21 | + ], |
| 22 | + |
| 23 | + 'visibility_required' => true, |
| 24 | + 'indentation_type' => true, |
| 25 | + 'no_useless_return' => true, |
| 26 | + |
| 27 | + 'switch_case_space' => true, |
| 28 | + 'switch_case_semicolon_to_colon' => true, |
| 29 | + |
| 30 | + 'array_syntax' => [ 'syntax' => 'short' ], |
| 31 | + 'list_syntax' => [ 'syntax' => 'short' ], |
| 32 | + |
| 33 | + 'no_leading_import_slash' => true, |
| 34 | + 'no_leading_namespace_whitespace' => true, |
| 35 | + |
| 36 | + 'array_indentation' => true, |
| 37 | + |
| 38 | + 'no_whitespace_in_blank_line' => true, |
| 39 | + 'no_trailing_whitespace' => true, |
| 40 | + |
| 41 | + 'phpdoc_add_missing_param_annotation' => [ 'only_untyped' => true, ], |
| 42 | + 'phpdoc_indent' => true, |
| 43 | + |
| 44 | + 'phpdoc_no_alias_tag' => true, |
| 45 | + 'phpdoc_no_package' => true, |
| 46 | + 'phpdoc_no_useless_inheritdoc' => true, |
| 47 | + |
| 48 | + 'phpdoc_order' => true, |
| 49 | + 'phpdoc_scalar' => true, |
| 50 | + 'phpdoc_single_line_var_spacing' => true, |
| 51 | + |
| 52 | + 'phpdoc_var_annotation_correct_order' => true, |
| 53 | + |
| 54 | + 'phpdoc_trim' => true, |
| 55 | + 'phpdoc_trim_consecutive_blank_line_separation' => true, |
| 56 | + |
| 57 | + 'phpdoc_types' => true, |
| 58 | + 'phpdoc_types_order' => [ |
| 59 | + 'null_adjustment' => 'always_last', |
| 60 | + 'sort_algorithm' => 'alpha', |
| 61 | + ], |
| 62 | + |
| 63 | + 'phpdoc_align' => [ |
| 64 | + 'align' => 'vertical', |
| 65 | + 'tags' => [ 'param' ], |
| 66 | + ], |
| 67 | + |
| 68 | + 'phpdoc_line_span' => [ |
| 69 | + 'const' => 'single', |
| 70 | + 'method' => 'multi', |
| 71 | + 'property' => 'single', |
| 72 | + ], |
| 73 | + |
| 74 | + 'short_scalar_cast' => true, |
| 75 | + |
| 76 | + 'standardize_not_equals' => true, |
| 77 | + 'ternary_operator_spaces' => true, |
| 78 | + 'no_spaces_after_function_name' => true, |
| 79 | + 'no_unneeded_control_parentheses' => true, |
| 80 | + |
| 81 | + 'return_type_declaration' => [ |
| 82 | + 'space_before' => 'one', |
| 83 | + ], |
| 84 | + |
| 85 | + 'single_line_after_imports' => true, |
| 86 | + 'single_blank_line_before_namespace' => true, |
| 87 | + 'blank_line_after_namespace' => true, |
| 88 | + 'single_blank_line_at_eof' => true, |
| 89 | + 'ternary_to_null_coalescing' => true, |
| 90 | + 'whitespace_after_comma_in_array' => true, |
| 91 | + |
| 92 | + 'cast_spaces' => [ 'space' => 'none' ], |
| 93 | + |
| 94 | + 'encoding' => true, |
| 95 | + |
| 96 | + 'space_after_semicolon' => [ |
| 97 | + 'remove_in_empty_for_expressions' => true, |
| 98 | + ], |
| 99 | + |
| 100 | + 'align_multiline_comment' => [ |
| 101 | + 'comment_type' => 'phpdocs_like', |
| 102 | + ], |
| 103 | + |
| 104 | + 'blank_line_before_statement' => [ |
| 105 | + 'statements' => [ 'continue', 'try', 'switch', 'exit', 'throw', 'return', 'do' ], |
| 106 | + ], |
| 107 | + |
| 108 | + 'no_superfluous_phpdoc_tags' => [ |
| 109 | + 'remove_inheritdoc' => true, |
| 110 | + ], |
| 111 | + 'no_superfluous_elseif' => true, |
| 112 | + |
| 113 | + 'no_useless_else' => true, |
| 114 | + |
| 115 | + 'combine_consecutive_issets' => true, |
| 116 | + 'escape_implicit_backslashes' => true, |
| 117 | + 'heredoc_to_nowdoc' => true, |
| 118 | + |
| 119 | + 'no_empty_phpdoc' => true, |
| 120 | + 'no_empty_statement' => true, |
| 121 | + 'no_empty_comment' => true, |
| 122 | + 'no_extra_blank_lines' => true, |
| 123 | + 'no_blank_lines_after_phpdoc' => true, |
| 124 | + |
| 125 | + 'no_spaces_around_offset' => [ |
| 126 | + 'positions' => [ 'outside' ], |
| 127 | + ], |
| 128 | + |
| 129 | + 'return_assignment' => true, |
| 130 | + 'lowercase_static_reference' => true, |
| 131 | + |
| 132 | + 'method_chaining_indentation' => true, |
| 133 | + |
| 134 | + 'elseif' => true, |
| 135 | + 'simple_to_complex_string_variable' => true, |
| 136 | + |
| 137 | + 'global_namespace_import' => [ |
| 138 | + 'import_classes' => false, |
| 139 | + 'import_constants' => false, |
| 140 | + 'import_functions' => false, |
| 141 | + ], |
| 142 | + 'single_line_comment_style' => true, |
| 143 | + |
| 144 | + 'is_null' => true, |
| 145 | + 'yoda_style' => [ |
| 146 | + 'equal' => false, |
| 147 | + 'identical' => false, |
| 148 | + 'less_and_greater' => null, |
| 149 | + ], |
| 150 | + ] |
| 151 | + ) |
| 152 | + ->setFinder($finder); |
| 153 | + |
| 154 | + |
0 commit comments