|
6 | 6 | ->setUsingCache(true)
|
7 | 7 | ->setRiskyAllowed(true)
|
8 | 8 | ->setRules([
|
9 |
| - '@Symfony' => true, |
| 9 | + 'align_multiline_comment' => true, |
10 | 10 | 'array_indentation' => true,
|
11 |
| - 'cast_spaces' => [ |
12 |
| - 'space' => 'single', |
13 |
| - ], |
| 11 | + 'array_syntax' => ['syntax' => 'short'], |
| 12 | + 'backtick_to_shell_exec' => true, |
| 13 | + 'binary_operator_spaces' => true, |
| 14 | + 'blank_line_after_namespace' => true, |
| 15 | + 'blank_line_after_opening_tag' => true, |
| 16 | + 'blank_line_before_statement' => true, |
| 17 | + 'braces' => true, |
| 18 | + 'cast_spaces' => true, |
| 19 | + 'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']], // const are often grouped with other related const |
| 20 | + 'class_definition' => false, |
| 21 | + 'class_keyword_remove' => false, // ::class keyword gives us better support in IDE |
14 | 22 | 'combine_consecutive_issets' => true,
|
15 |
| - 'concat_space' => [ |
16 |
| - 'spacing' => 'one', |
17 |
| - ], |
18 |
| - 'error_suppression' => [ |
19 |
| - 'mute_deprecation_error' => false, |
20 |
| - 'noise_remaining_usages' => false, |
21 |
| - 'noise_remaining_usages_exclude' => [], |
22 |
| - ], |
23 |
| - 'function_to_constant' => false, |
| 23 | + 'combine_consecutive_unsets' => true, |
| 24 | + 'combine_nested_dirname' => true, |
| 25 | + 'comment_to_phpdoc' => false, // interferes with annotations |
| 26 | + 'compact_nullable_typehint' => true, |
| 27 | + 'concat_space' => ['spacing' => 'one'], |
| 28 | + 'constant_case' => true, |
| 29 | + 'date_time_immutable' => false, // Break our unit tests |
| 30 | + 'declare_equal_normalize' => true, |
| 31 | + 'declare_strict_types' => false, // Too early to adopt strict types |
| 32 | + 'dir_constant' => true, |
| 33 | + 'doctrine_annotation_array_assignment' => true, |
| 34 | + 'doctrine_annotation_braces' => true, |
| 35 | + 'doctrine_annotation_indentation' => true, |
| 36 | + 'doctrine_annotation_spaces' => true, |
| 37 | + 'elseif' => true, |
| 38 | + 'encoding' => true, |
| 39 | + 'ereg_to_preg' => true, |
| 40 | + 'escape_implicit_backslashes' => true, |
| 41 | + 'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read |
| 42 | + 'explicit_string_variable' => false, // I feel it makes the code actually harder to read |
| 43 | + 'final_class' => false, // We need non-final classes |
| 44 | + 'final_internal_class' => true, |
| 45 | + 'final_public_method_for_abstract_class' => false, // We need non-final methods |
| 46 | + 'fopen_flag_order' => true, |
| 47 | + 'fopen_flags' => true, |
| 48 | + 'full_opening_tag' => true, |
| 49 | + 'fully_qualified_strict_types' => true, |
| 50 | + 'function_declaration' => true, |
| 51 | + 'function_to_constant' => true, |
| 52 | + 'function_typehint_space' => true, |
| 53 | + 'general_phpdoc_annotation_remove' => ['annotations' => ['access', 'category', 'copyright', 'throws']], |
| 54 | + 'global_namespace_import' => true, |
| 55 | + 'header_comment' => false, // We don't use common header in all our files |
| 56 | + 'heredoc_indentation' => false, // Requires PHP >= 7.3 |
| 57 | + 'heredoc_to_nowdoc' => false, // Not sure about this one |
| 58 | + 'implode_call' => true, |
| 59 | + 'include' => true, |
| 60 | + 'increment_style' => true, |
| 61 | + 'indentation_type' => true, |
| 62 | + 'is_null' => true, |
| 63 | + 'line_ending' => true, |
| 64 | + 'linebreak_after_opening_tag' => true, |
| 65 | + 'list_syntax' => ['syntax' => 'short'], |
| 66 | + 'logical_operators' => true, |
| 67 | + 'lowercase_cast' => true, |
| 68 | + 'lowercase_keywords' => true, |
| 69 | + 'lowercase_static_reference' => true, |
| 70 | + 'magic_constant_casing' => true, |
| 71 | + 'magic_method_casing' => true, |
| 72 | + 'mb_str_functions' => false, // No, too dangerous to change that |
| 73 | + 'method_argument_space' => true, |
24 | 74 | 'method_chaining_indentation' => true,
|
25 |
| - 'no_alias_functions' => false, |
26 |
| - 'no_superfluous_phpdoc_tags' => false, |
27 |
| - 'non_printable_character' => [ |
28 |
| - 'use_escape_sequences_in_strings' => true, |
29 |
| - ], |
30 |
| - 'phpdoc_align' => [ |
31 |
| - 'align' => 'left', |
32 |
| - ], |
33 |
| - 'phpdoc_summary' => false, |
34 |
| - 'protected_to_private' => false, |
35 |
| - 'self_accessor' => false, |
| 75 | + 'modernize_types_casting' => true, |
| 76 | + 'multiline_comment_opening_closing' => true, |
| 77 | + 'multiline_whitespace_before_semicolons' => true, |
| 78 | + 'native_constant_invocation' => false, // Micro optimization that look messy |
| 79 | + 'native_function_casing' => true, |
| 80 | + 'native_function_invocation' => false, // I suppose this would be best, but I am still unconvinced about the visual aspect of it |
| 81 | + 'native_function_type_declaration_casing' => true, |
| 82 | + 'new_with_braces' => true, |
| 83 | + 'no_alias_functions' => true, |
| 84 | + 'no_alternative_syntax' => true, |
| 85 | + 'no_binary_string' => true, |
| 86 | + 'no_blank_lines_after_class_opening' => true, |
| 87 | + 'no_blank_lines_after_phpdoc' => true, |
| 88 | + 'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace |
| 89 | + 'no_break_comment' => true, |
| 90 | + 'no_closing_tag' => true, |
| 91 | + 'no_empty_comment' => true, |
| 92 | + 'no_empty_phpdoc' => true, |
| 93 | + 'no_empty_statement' => true, |
| 94 | + 'no_extra_blank_lines' => true, |
| 95 | + 'no_homoglyph_names' => true, |
| 96 | + 'no_leading_import_slash' => true, |
| 97 | + 'no_leading_namespace_whitespace' => true, |
| 98 | + 'no_mixed_echo_print' => true, |
| 99 | + 'no_multiline_whitespace_around_double_arrow' => true, |
| 100 | + 'no_null_property_initialization' => true, |
| 101 | + 'no_php4_constructor' => true, |
| 102 | + 'no_short_bool_cast' => true, |
| 103 | + 'echo_tag_syntax' => ['format' => 'long'], |
| 104 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 105 | + 'no_spaces_after_function_name' => true, |
| 106 | + 'no_spaces_around_offset' => true, |
| 107 | + 'no_spaces_inside_parenthesis' => true, |
| 108 | + 'no_superfluous_elseif' => false, // Might be risky on a huge code base |
| 109 | + 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], |
| 110 | + 'no_trailing_comma_in_list_call' => true, |
| 111 | + 'no_trailing_comma_in_singleline_array' => true, |
| 112 | + 'no_trailing_whitespace' => true, |
| 113 | + 'no_trailing_whitespace_in_comment' => true, |
| 114 | + 'no_unneeded_control_parentheses' => true, |
| 115 | + 'no_unneeded_curly_braces' => true, |
| 116 | + 'no_unneeded_final_method' => true, |
| 117 | + 'no_unreachable_default_argument_value' => true, |
| 118 | + 'no_unset_cast' => true, |
| 119 | + 'no_unset_on_property' => true, |
| 120 | + 'no_unused_imports' => true, |
| 121 | + 'no_useless_else' => true, |
| 122 | + 'no_useless_return' => true, |
| 123 | + 'no_whitespace_before_comma_in_array' => true, |
| 124 | + 'no_whitespace_in_blank_line' => true, |
| 125 | + 'non_printable_character' => true, |
| 126 | + 'normalize_index_brace' => true, |
| 127 | + 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces |
| 128 | + 'not_operator_with_successor_space' => false, // idem |
| 129 | + 'nullable_type_declaration_for_default_null_value' => true, |
| 130 | + 'object_operator_without_whitespace' => true, |
| 131 | + 'ordered_class_elements' => false, // We prefer to keep some freedom |
| 132 | + 'ordered_imports' => true, |
| 133 | + 'ordered_interfaces' => true, |
| 134 | + 'php_unit_construct' => true, |
| 135 | + 'php_unit_dedicate_assert' => true, |
| 136 | + 'php_unit_dedicate_assert_internal_type' => true, |
| 137 | + 'php_unit_expectation' => true, |
| 138 | + 'php_unit_fqcn_annotation' => true, |
| 139 | + 'php_unit_internal_class' => false, // Because tests are excluded from package |
| 140 | + 'php_unit_method_casing' => true, |
| 141 | + 'php_unit_mock' => true, |
| 142 | + 'php_unit_mock_short_will_return' => true, |
| 143 | + 'php_unit_namespaced' => true, |
| 144 | + 'php_unit_no_expectation_annotation' => true, |
| 145 | + 'phpdoc_order_by_value' => ['annotations' => ['covers']], |
| 146 | + 'php_unit_set_up_tear_down_visibility' => true, |
| 147 | + 'php_unit_size_class' => false, // That seems extra work to maintain for little benefits |
| 148 | + 'php_unit_strict' => false, // We sometime actually need assertEquals |
| 149 | + 'php_unit_test_annotation' => true, |
| 150 | + 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], |
| 151 | + 'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage |
| 152 | + 'phpdoc_add_missing_param_annotation' => false, // Don't add things that bring no value |
| 153 | + 'phpdoc_align' => false, // Waste of time |
| 154 | + 'phpdoc_annotation_without_dot' => true, |
| 155 | + 'phpdoc_indent' => true, |
| 156 | + //'phpdoc_inline_tag' => true, |
| 157 | + 'phpdoc_line_span' => false, // Unfortunately our old comments turn even uglier with this |
| 158 | + 'phpdoc_no_access' => true, |
| 159 | + 'phpdoc_no_alias_tag' => true, |
| 160 | + 'phpdoc_no_empty_return' => true, |
| 161 | + 'phpdoc_no_package' => true, |
| 162 | + 'phpdoc_no_useless_inheritdoc' => true, |
| 163 | + 'phpdoc_order' => true, |
| 164 | + 'phpdoc_return_self_reference' => true, |
| 165 | + 'phpdoc_scalar' => true, |
| 166 | + 'phpdoc_separation' => true, |
| 167 | + 'phpdoc_single_line_var_spacing' => true, |
| 168 | + 'phpdoc_summary' => true, |
| 169 | + 'phpdoc_to_comment' => false, // interferes with annotations |
| 170 | + 'phpdoc_to_param_type' => false, // Because experimental, but interesting for one shot use |
| 171 | + 'phpdoc_to_return_type' => false, // idem |
| 172 | + 'phpdoc_trim' => true, |
| 173 | + 'phpdoc_trim_consecutive_blank_line_separation' => true, |
| 174 | + 'phpdoc_types' => true, |
| 175 | + 'phpdoc_types_order' => true, |
| 176 | + 'phpdoc_var_annotation_correct_order' => true, |
| 177 | + 'phpdoc_var_without_name' => true, |
| 178 | + 'pow_to_exponentiation' => true, |
| 179 | + 'protected_to_private' => true, |
| 180 | + 'psr_autoloading' => true, |
| 181 | + 'random_api_migration' => true, |
| 182 | + 'return_assignment' => false, // Sometimes useful for clarity or debug |
| 183 | + 'return_type_declaration' => true, |
| 184 | + 'self_accessor' => true, |
| 185 | + 'self_static_accessor' => true, |
| 186 | + 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` |
| 187 | + 'set_type_to_cast' => true, |
| 188 | + 'short_scalar_cast' => true, |
| 189 | + 'simple_to_complex_string_variable' => false, // Would differ from TypeScript without obvious advantages |
| 190 | + 'simplified_null_return' => false, // Even if technically correct we prefer to be explicit |
| 191 | + 'single_blank_line_at_eof' => true, |
| 192 | + 'single_blank_line_before_namespace' => true, |
| 193 | + 'single_class_element_per_statement' => true, |
| 194 | + 'single_import_per_statement' => true, |
| 195 | + 'single_line_after_imports' => true, |
| 196 | + 'single_line_comment_style' => true, |
| 197 | + 'single_line_throw' => false, // I don't see any reason for having a special case for Exception |
| 198 | + 'single_quote' => true, |
| 199 | + 'single_trait_insert_per_statement' => true, |
| 200 | + 'space_after_semicolon' => true, |
| 201 | + 'standardize_increment' => true, |
| 202 | + 'standardize_not_equals' => true, |
| 203 | + 'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()` |
| 204 | + 'strict_comparison' => false, // No, too dangerous to change that |
| 205 | + 'strict_param' => false, // No, too dangerous to change that |
| 206 | + 'string_line_ending' => true, |
| 207 | + 'switch_case_semicolon_to_colon' => true, |
| 208 | + 'switch_case_space' => true, |
| 209 | + 'ternary_operator_spaces' => true, |
| 210 | + 'ternary_to_null_coalescing' => true, |
| 211 | + 'trailing_comma_in_multiline' => true, |
| 212 | + 'trim_array_spaces' => true, |
| 213 | + 'unary_operator_spaces' => true, |
| 214 | + 'visibility_required' => ['elements' => ['property', 'method']], // not const |
| 215 | + 'void_return' => true, |
| 216 | + 'whitespace_after_comma_in_array' => true, |
36 | 217 | 'yoda_style' => false,
|
37 |
| - 'single_line_throw' => false, |
38 |
| - 'no_alias_language_construct_call' => false, |
39 | 218 | ])
|
40 | 219 | ->getFinder()
|
41 | 220 | ->in(__DIR__)
|
|
0 commit comments