@@ -10,21 +10,27 @@ return PhpCsFixer\Config::create()
1010 ->setCacheFile (sys_get_temp_dir () . '/php-cs-fixer ' . preg_replace ('~\W~ ' , '- ' , __DIR__ ))
1111 ->setRules ([
1212 'align_multiline_comment ' => true ,
13+ 'array_indentation ' => true ,
1314 'array_syntax ' => ['syntax ' => 'short ' ],
1415 'backtick_to_shell_exec ' => true ,
1516 'binary_operator_spaces ' => true ,
1617 'blank_line_after_namespace ' => true ,
1718 'blank_line_after_opening_tag ' => true ,
19+ 'blank_line_before_return ' => false , // Deprecated
1820 'blank_line_before_statement ' => true ,
1921 'braces ' => true ,
2022 'cast_spaces ' => true ,
2123 'class_attributes_separation ' => ['elements ' => ['method ' , 'property ' ]], // const are often grouped with other related const
2224 'class_definition ' => true ,
23- 'class_keyword_remove ' => false , // ::class keyword gives us beter support in IDE
25+ 'class_keyword_remove ' => false , // ::class keyword gives us better support in IDE
2426 'combine_consecutive_issets ' => true ,
2527 'combine_consecutive_unsets ' => true ,
28+ 'combine_nested_dirname ' => true ,
29+ 'comment_to_phpdoc ' => true ,
2630 'compact_nullable_typehint ' => true ,
2731 'concat_space ' => ['spacing ' => 'one ' ],
32+ 'constant_case ' => true ,
33+ 'date_time_immutable ' => true ,
2834 'declare_equal_normalize ' => true ,
2935 'declare_strict_types ' => true ,
3036 'dir_constant ' => true ,
@@ -35,39 +41,57 @@ return PhpCsFixer\Config::create()
3541 'elseif ' => true ,
3642 'encoding ' => true ,
3743 'ereg_to_preg ' => true ,
44+ 'error_suppression ' => true ,
3845 'escape_implicit_backslashes ' => true ,
3946 'explicit_indirect_variable ' => false , // I feel it makes the code actually harder to read
40- 'explicit_string_variable ' => true ,
47+ 'explicit_string_variable ' => false , // I feel it makes the code actually harder to read
48+ 'final_class ' => false , // We need non-final classes
4149 'final_internal_class ' => true ,
50+ 'final_public_method_for_abstract_class ' => false , // We need non-final methods
51+ 'final_static_access ' => true ,
52+ 'fopen_flag_order ' => true ,
53+ 'fopen_flags ' => true ,
4254 'full_opening_tag ' => true ,
55+ 'fully_qualified_strict_types ' => true ,
4356 'function_declaration ' => true ,
4457 'function_to_constant ' => true ,
4558 'function_typehint_space ' => true ,
4659 'general_phpdoc_annotation_remove ' => false , // No use for that
47- 'hash_to_slash_comment ' => true ,
60+ 'global_namespace_import ' => true ,
61+ 'hash_to_slash_comment ' => false , // Deprecated
4862 'header_comment ' => false , // We don't use common header in all our files
63+ 'heredoc_indentation ' => false , // Requires PHP >= 7.3
4964 'heredoc_to_nowdoc ' => false , // Not sure about this one
65+ 'implode_call ' => true ,
5066 'include ' => true ,
5167 'increment_style ' => true ,
5268 'indentation_type ' => true ,
53- 'is_null ' => ['use_yoda_style ' => false ],
54- 'linebreak_after_opening_tag ' => true ,
69+ 'is_null ' => true ,
5570 'line_ending ' => true ,
71+ 'linebreak_after_opening_tag ' => true ,
5672 'list_syntax ' => ['syntax ' => 'short ' ],
73+ 'logical_operators ' => true ,
5774 'lowercase_cast ' => true ,
58- 'lowercase_constants ' => true ,
75+ 'lowercase_constants ' => false , // Deprecated
5976 'lowercase_keywords ' => true ,
77+ 'lowercase_static_reference ' => true ,
6078 'magic_constant_casing ' => true ,
79+ 'magic_method_casing ' => true ,
6180 'mb_str_functions ' => true ,
6281 'method_argument_space ' => true ,
6382 'method_chaining_indentation ' => true ,
64- 'method_separation ' => true ,
83+ 'method_separation ' => false , // Deprecated
6584 'modernize_types_casting ' => true ,
6685 'multiline_comment_opening_closing ' => true ,
86+ 'multiline_whitespace_before_semicolons ' => true ,
87+ 'native_constant_invocation ' => false , // Micro optimization that look messy
6788 'native_function_casing ' => true ,
6889 'native_function_invocation ' => false , // I suppose this would be best, but I am still unconvinced about the visual aspect of it
90+ 'native_function_type_declaration_casing ' => true ,
6991 'new_with_braces ' => true ,
7092 'no_alias_functions ' => true ,
93+ 'no_alternative_syntax ' => true ,
94+ 'no_binary_string ' => true ,
7195 'no_blank_lines_after_class_opening ' => true ,
7296 'no_blank_lines_after_phpdoc ' => true ,
7397 'no_blank_lines_before_namespace ' => false , // we want 1 blank line before namespace
@@ -77,46 +101,71 @@ return PhpCsFixer\Config::create()
77101 'no_empty_phpdoc ' => true ,
78102 'no_empty_statement ' => true ,
79103 'no_extra_blank_lines ' => true ,
104+ 'no_extra_consecutive_blank_lines ' => false , // Deprecated
80105 'no_homoglyph_names ' => true ,
81106 'no_leading_import_slash ' => true ,
82107 'no_leading_namespace_whitespace ' => true ,
83108 'no_mixed_echo_print ' => true ,
84109 'no_multiline_whitespace_around_double_arrow ' => true ,
85- 'no_multiline_whitespace_before_semicolons ' => true ,
86- 'non_printable_character ' => true ,
110+ 'no_multiline_whitespace_before_semicolons ' => false , // Deprecated
87111 'no_null_property_initialization ' => true ,
88112 'no_php4_constructor ' => true ,
89- 'normalize_index_brace ' => true ,
90113 'no_short_bool_cast ' => true ,
91114 'no_short_echo_tag ' => true ,
92115 'no_singleline_whitespace_before_semicolons ' => true ,
93116 'no_spaces_after_function_name ' => true ,
94117 'no_spaces_around_offset ' => true ,
95118 'no_spaces_inside_parenthesis ' => true ,
96119 'no_superfluous_elseif ' => true ,
97- 'not_operator_with_space ' => false , // No we prefer to keep '!' without spaces
98- 'not_operator_with_successor_space ' => false , // idem
120+ 'no_superfluous_phpdoc_tags ' => ['allow_mixed ' => true ],
99121 'no_trailing_comma_in_list_call ' => true ,
100122 'no_trailing_comma_in_singleline_array ' => true ,
101- 'no_trailing_whitespace_in_comment ' => true ,
102123 'no_trailing_whitespace ' => true ,
124+ 'no_trailing_whitespace_in_comment ' => true ,
103125 'no_unneeded_control_parentheses ' => true ,
104126 'no_unneeded_curly_braces ' => true ,
105127 'no_unneeded_final_method ' => true ,
106128 'no_unreachable_default_argument_value ' => true ,
129+ 'no_unset_cast ' => true ,
130+ 'no_unset_on_property ' => true ,
107131 'no_unused_imports ' => true ,
108132 'no_useless_else ' => true ,
109133 'no_useless_return ' => true ,
110134 'no_whitespace_before_comma_in_array ' => true ,
111135 'no_whitespace_in_blank_line ' => true ,
136+ 'non_printable_character ' => true ,
137+ 'normalize_index_brace ' => true ,
138+ 'not_operator_with_space ' => false , // No we prefer to keep '!' without spaces
139+ 'not_operator_with_successor_space ' => false , // idem
140+ 'nullable_type_declaration_for_default_null_value ' => true ,
112141 'object_operator_without_whitespace ' => true ,
113142 'ordered_class_elements ' => false , // We prefer to keep some freedom
114143 'ordered_imports ' => true ,
144+ 'ordered_interfaces ' => true ,
145+ 'php_unit_construct ' => true ,
146+ 'php_unit_dedicate_assert ' => true ,
147+ 'php_unit_dedicate_assert_internal_type ' => true ,
148+ 'php_unit_expectation ' => true ,
149+ 'php_unit_fqcn_annotation ' => true ,
150+ 'php_unit_internal_class ' => false , // Because tests are excluded from package
151+ 'php_unit_method_casing ' => true ,
152+ 'php_unit_mock ' => true ,
153+ 'php_unit_mock_short_will_return ' => true ,
154+ 'php_unit_namespaced ' => true ,
155+ 'php_unit_no_expectation_annotation ' => true ,
156+ 'php_unit_ordered_covers ' => true ,
157+ 'php_unit_set_up_tear_down_visibility ' => true ,
158+ 'php_unit_size_class ' => false , // That seems extra work to maintain for little benefits
159+ 'php_unit_strict ' => false , // We sometime actually need assertEquals
160+ 'php_unit_test_annotation ' => true ,
161+ 'php_unit_test_case_static_method_calls ' => ['call_type ' => 'self ' ],
162+ 'php_unit_test_class_requires_covers ' => false , // We don't care as much as we should about coverage
115163 'phpdoc_add_missing_param_annotation ' => true ,
116164 'phpdoc_align ' => false , // Waste of time
117165 'phpdoc_annotation_without_dot ' => true ,
118166 'phpdoc_indent ' => true ,
119167 'phpdoc_inline_tag ' => true ,
168+ 'phpdoc_line_span ' => true ,
120169 'phpdoc_no_access ' => true ,
121170 'phpdoc_no_alias_tag ' => true ,
122171 'phpdoc_no_empty_return ' => true ,
@@ -129,43 +178,46 @@ return PhpCsFixer\Config::create()
129178 'phpdoc_single_line_var_spacing ' => true ,
130179 'phpdoc_summary ' => false , // We usually don't generate documentation so punctuation is not important
131180 'phpdoc_to_comment ' => true ,
181+ 'phpdoc_to_param_type ' => false , // Because experimental, but interesting for one shot use
182+ 'phpdoc_to_return_type ' => false , // idem
132183 'phpdoc_trim ' => true ,
133- 'phpdoc_types_order ' => true ,
184+ 'phpdoc_trim_consecutive_blank_line_separation ' => true ,
134185 'phpdoc_types ' => true ,
186+ 'phpdoc_types_order ' => true ,
187+ 'phpdoc_var_annotation_correct_order ' => true ,
135188 'phpdoc_var_without_name ' => true ,
136- 'php_unit_construct ' => true ,
137- 'php_unit_dedicate_assert ' => true ,
138- 'php_unit_expectation ' => true ,
139- 'php_unit_fqcn_annotation ' => true ,
140- 'php_unit_mock ' => true ,
141- 'php_unit_namespaced ' => true ,
142- 'php_unit_no_expectation_annotation ' => true ,
143- 'php_unit_strict ' => false , // We sometime actually need assertEquals
144- 'php_unit_test_annotation ' => true ,
145- 'php_unit_test_class_requires_covers ' => false , // We don't care as much as we should about coverage
146189 'pow_to_exponentiation ' => true ,
190+ 'pre_increment ' => false , // Deprecated
147191 'protected_to_private ' => true ,
148192 'psr0 ' => true ,
149193 'psr4 ' => true ,
150194 'random_api_migration ' => true ,
195+ 'return_assignment ' => false , // Sometimes useful for clarity or debug
151196 'return_type_declaration ' => true ,
152197 'self_accessor ' => true ,
198+ 'self_static_accessor ' => true ,
153199 'semicolon_after_instruction ' => false , // We prefer to keep .phtml files without semicolon
200+ 'set_type_to_cast ' => true ,
154201 'short_scalar_cast ' => true ,
155- 'silenced_deprecation_error ' => true ,
202+ 'silenced_deprecation_error ' => false , // Deprecated
203+ 'simple_to_complex_string_variable ' => false , // Would differ from TypeScript without obvious advantages
156204 'simplified_null_return ' => false , // Even if technically correct we prefer to be explicit
157205 'single_blank_line_at_eof ' => true ,
158206 'single_blank_line_before_namespace ' => true ,
159207 'single_class_element_per_statement ' => true ,
160208 'single_import_per_statement ' => true ,
161209 'single_line_after_imports ' => true ,
162210 'single_line_comment_style ' => true ,
211+ 'single_line_throw ' => false , // I don't see any reason for having a special case for Exception
163212 'single_quote ' => true ,
213+ 'single_trait_insert_per_statement ' => true ,
164214 'space_after_semicolon ' => true ,
215+ 'standardize_increment ' => true ,
165216 'standardize_not_equals ' => true ,
166217 'static_lambda ' => false , // Risky if we can't guarantee nobody use `bindTo()`
167218 'strict_comparison ' => true ,
168219 'strict_param ' => true ,
220+ 'string_line_ending ' => true ,
169221 'switch_case_semicolon_to_colon ' => true ,
170222 'switch_case_space ' => true ,
171223 'ternary_operator_spaces ' => true ,
0 commit comments