@@ -10,165 +10,175 @@ $finder = PhpCsFixer\Finder::create()
1010 ->in (__DIR__ );
1111
1212return PhpCsFixer \Config::create ()
13- ->setRiskyAllowed (true )
14- ->setFinder ($ finder )
15- ->setRules ([
16- 'align_multiline_comment ' => true ,
17- 'array_syntax ' => ['syntax ' => 'short ' ],
18- 'binary_operator_spaces ' => true ,
19- 'blank_line_after_namespace ' => true ,
20- 'blank_line_after_opening_tag ' => true ,
21- 'blank_line_before_statement ' => true ,
22- 'braces ' => true ,
23- 'cast_spaces ' => true ,
24- 'class_definition ' => true ,
25- 'class_keyword_remove ' => false , // ::class keyword gives us beter support in IDE
26- 'combine_consecutive_issets ' => true ,
27- 'combine_consecutive_unsets ' => true ,
28- 'compact_nullable_typehint ' => true ,
29- 'concat_space ' => ['spacing ' => 'one ' ],
30- 'declare_equal_normalize ' => true ,
31- 'declare_strict_types ' => true ,
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- 'full_opening_tag ' => true ,
41- 'function_declaration ' => true ,
42- 'function_to_constant ' => true ,
43- 'function_typehint_space ' => true ,
44- 'general_phpdoc_annotation_remove ' => false , // No use for that
45- 'hash_to_slash_comment ' => true ,
46- 'header_comment ' => false , // We don't use common header in all our files
47- 'heredoc_to_nowdoc ' => false , // Not sure about this one
48- 'include ' => true ,
49- 'increment_style ' => true ,
50- 'indentation_type ' => true ,
51- 'is_null ' => ['use_yoda_style ' => false ],
52- 'linebreak_after_opening_tag ' => true ,
53- 'line_ending ' => true ,
54- 'list_syntax ' => ['syntax ' => 'short ' ],
55- 'lowercase_cast ' => true ,
56- 'lowercase_constants ' => true ,
57- 'lowercase_keywords ' => true ,
58- 'magic_constant_casing ' => true ,
59- 'mb_str_functions ' => true ,
60- 'method_argument_space ' => true ,
61- 'method_separation ' => true ,
62- 'modernize_types_casting ' => true ,
63- 'native_function_casing ' => true ,
64- 'native_function_invocation ' => false , // I suppose this would be best, but I am still unconvinced about the visual aspect of it
65- 'new_with_braces ' => true ,
66- 'no_alias_functions ' => true ,
67- 'no_blank_lines_after_class_opening ' => true ,
68- 'no_blank_lines_after_phpdoc ' => true ,
69- 'no_blank_lines_before_namespace ' => false , // we want 1 blank line before namespace
70- 'no_break_comment ' => true ,
71- 'no_closing_tag ' => true ,
72- 'no_empty_comment ' => true ,
73- 'no_empty_phpdoc ' => true ,
74- 'no_empty_statement ' => true ,
75- 'no_extra_consecutive_blank_lines ' => ['break ' , 'continue ' , 'extra ' , 'return ' , 'throw ' , 'use ' , 'useTrait ' , 'curly_brace_block ' , 'parenthesis_brace_block ' , 'square_brace_block ' ],
76- 'no_homoglyph_names ' => true ,
77- 'no_leading_import_slash ' => true ,
78- 'no_leading_namespace_whitespace ' => true ,
79- 'no_mixed_echo_print ' => true ,
80- 'no_multiline_whitespace_around_double_arrow ' => true ,
81- 'no_multiline_whitespace_before_semicolons ' => true ,
82- 'non_printable_character ' => true ,
83- 'no_null_property_initialization ' => true ,
84- 'no_php4_constructor ' => true ,
85- 'normalize_index_brace ' => true ,
86- 'no_short_bool_cast ' => true ,
87- 'no_short_echo_tag ' => true ,
88- 'no_singleline_whitespace_before_semicolons ' => true ,
89- 'no_spaces_after_function_name ' => true ,
90- 'no_spaces_around_offset ' => true ,
91- 'no_spaces_inside_parenthesis ' => true ,
92- 'no_superfluous_elseif ' => true ,
93- 'not_operator_with_space ' => false , // No we prefer to keep '!' without spaces
94- 'not_operator_with_successor_space ' => false , // idem
95- 'no_trailing_comma_in_list_call ' => true ,
96- 'no_trailing_comma_in_singleline_array ' => true ,
97- 'no_trailing_whitespace_in_comment ' => true ,
98- 'no_trailing_whitespace ' => true ,
99- 'no_unneeded_control_parentheses ' => true ,
100- 'no_unneeded_curly_braces ' => true ,
101- 'no_unneeded_final_method ' => true ,
102- 'no_unreachable_default_argument_value ' => true ,
103- 'no_unused_imports ' => true ,
104- 'no_useless_else ' => true ,
105- 'no_useless_return ' => true ,
106- 'no_whitespace_before_comma_in_array ' => true ,
107- 'no_whitespace_in_blank_line ' => true ,
108- 'object_operator_without_whitespace ' => true ,
109- 'ordered_class_elements ' => false , // We prefer to keep some freedom
110- 'ordered_imports ' => true ,
111- 'phpdoc_add_missing_param_annotation ' => true ,
112- 'phpdoc_align ' => false , // Waste of time
113- 'phpdoc_annotation_without_dot ' => true ,
114- 'phpdoc_indent ' => true ,
115- 'phpdoc_inline_tag ' => true ,
116- 'phpdoc_no_access ' => true ,
117- 'phpdoc_no_alias_tag ' => true ,
118- 'phpdoc_no_empty_return ' => true ,
119- 'phpdoc_no_package ' => true ,
120- 'phpdoc_no_useless_inheritdoc ' => true ,
121- 'phpdoc_order ' => true ,
122- 'phpdoc_return_self_reference ' => true ,
123- 'phpdoc_scalar ' => true ,
124- 'phpdoc_separation ' => true ,
125- 'phpdoc_single_line_var_spacing ' => true ,
126- 'phpdoc_summary ' => false , // We usually don't generate documentation so punctuation is not important
127- 'phpdoc_to_comment ' => true ,
128- 'phpdoc_trim ' => true ,
129- 'phpdoc_types_order ' => true ,
130- 'phpdoc_types ' => true ,
131- 'phpdoc_var_without_name ' => true ,
132- 'php_unit_construct ' => true ,
133- 'php_unit_dedicate_assert ' => true ,
134- 'php_unit_expectation ' => true ,
135- 'php_unit_mock ' => true ,
136- 'php_unit_namespaced ' => true ,
137- 'php_unit_no_expectation_annotation ' => true ,
138- 'php_unit_fqcn_annotation ' => true ,
139- 'php_unit_strict ' => false , // We sometime actually need assertEquals
140- 'php_unit_test_class_requires_covers ' => false , // We don't care as much as we should about coverage
141- 'pow_to_exponentiation ' => true ,
142- 'protected_to_private ' => true ,
143- 'psr0 ' => true ,
144- 'psr4 ' => true ,
145- 'random_api_migration ' => true ,
146- 'return_type_declaration ' => true ,
147- 'self_accessor ' => true ,
148- 'semicolon_after_instruction ' => false , // We prefer to keep .phtml files without semicolon
149- 'short_scalar_cast ' => true ,
150- 'silenced_deprecation_error ' => true ,
151- 'simplified_null_return ' => false , // Even if technically correct we prefer to be explicit
152- 'single_blank_line_at_eof ' => true ,
153- 'single_blank_line_before_namespace ' => true ,
154- 'single_class_element_per_statement ' => true ,
155- 'single_import_per_statement ' => true ,
156- 'single_line_after_imports ' => true ,
157- 'single_line_comment_style ' => true ,
158- 'single_quote ' => true ,
159- 'space_after_semicolon ' => true ,
160- 'standardize_not_equals ' => true ,
161- 'strict_comparison ' => true ,
162- 'strict_param ' => true ,
163- 'switch_case_semicolon_to_colon ' => true ,
164- 'switch_case_space ' => true ,
165- 'ternary_operator_spaces ' => true ,
166- 'ternary_to_null_coalescing ' => true ,
167- 'trailing_comma_in_multiline_array ' => true ,
168- 'trim_array_spaces ' => true ,
169- 'unary_operator_spaces ' => true ,
170- 'visibility_required ' => true ,
171- 'void_return ' => true ,
172- 'whitespace_after_comma_in_array ' => true ,
173- 'yoda_style ' => false ,
13+ ->setRiskyAllowed (true )
14+ ->setFinder ($ finder )
15+ ->setRules ([
16+ 'align_multiline_comment ' => true ,
17+ 'array_syntax ' => ['syntax ' => 'short ' ],
18+ 'backtick_to_shell_exec ' => true ,
19+ 'binary_operator_spaces ' => true ,
20+ 'blank_line_after_namespace ' => true ,
21+ 'blank_line_after_opening_tag ' => true ,
22+ 'blank_line_before_statement ' => true ,
23+ 'braces ' => true ,
24+ 'cast_spaces ' => true ,
25+ 'class_attributes_separation ' => ['elements ' => ['method ' , 'property ' ]], // const are often grouped with other related const
26+ 'class_definition ' => true ,
27+ 'class_keyword_remove ' => false , // ::class keyword gives us beter support in IDE
28+ 'combine_consecutive_issets ' => true ,
29+ 'combine_consecutive_unsets ' => true ,
30+ 'compact_nullable_typehint ' => true ,
31+ 'concat_space ' => ['spacing ' => 'one ' ],
32+ 'declare_equal_normalize ' => true ,
33+ 'declare_strict_types ' => true ,
34+ 'dir_constant ' => true ,
35+ 'doctrine_annotation_array_assignment ' => true ,
36+ 'doctrine_annotation_braces ' => true ,
37+ 'doctrine_annotation_indentation ' => true ,
38+ 'doctrine_annotation_spaces ' => true ,
39+ 'elseif ' => true ,
40+ 'encoding ' => true ,
41+ 'ereg_to_preg ' => true ,
42+ 'escape_implicit_backslashes ' => true ,
43+ 'explicit_indirect_variable ' => false , // I feel it makes the code actually harder to read
44+ 'explicit_string_variable ' => true ,
45+ 'final_internal_class ' => true ,
46+ 'full_opening_tag ' => true ,
47+ 'function_declaration ' => true ,
48+ 'function_to_constant ' => true ,
49+ 'function_typehint_space ' => true ,
50+ 'general_phpdoc_annotation_remove ' => false , // No use for that
51+ 'hash_to_slash_comment ' => true ,
52+ 'header_comment ' => false , // We don't use common header in all our files
53+ 'heredoc_to_nowdoc ' => false , // Not sure about this one
54+ 'include ' => true ,
55+ 'increment_style ' => true ,
56+ 'indentation_type ' => true ,
57+ 'is_null ' => ['use_yoda_style ' => false ],
58+ 'linebreak_after_opening_tag ' => true ,
59+ 'line_ending ' => true ,
60+ 'list_syntax ' => ['syntax ' => 'short ' ],
61+ 'lowercase_cast ' => true ,
62+ 'lowercase_constants ' => true ,
63+ 'lowercase_keywords ' => true ,
64+ 'magic_constant_casing ' => true ,
65+ 'mb_str_functions ' => true ,
66+ 'method_argument_space ' => true ,
67+ 'method_chaining_indentation ' => true ,
68+ 'method_separation ' => true ,
69+ 'modernize_types_casting ' => true ,
70+ 'multiline_comment_opening_closing ' => true ,
71+ 'native_function_casing ' => true ,
72+ 'native_function_invocation ' => false , // I suppose this would be best, but I am still unconvinced about the visual aspect of it
73+ 'new_with_braces ' => true ,
74+ 'no_alias_functions ' => true ,
75+ 'no_blank_lines_after_class_opening ' => true ,
76+ 'no_blank_lines_after_phpdoc ' => true ,
77+ 'no_blank_lines_before_namespace ' => false , // we want 1 blank line before namespace
78+ 'no_break_comment ' => true ,
79+ 'no_closing_tag ' => true ,
80+ 'no_empty_comment ' => true ,
81+ 'no_empty_phpdoc ' => true ,
82+ 'no_empty_statement ' => true ,
83+ 'no_extra_blank_lines ' => true ,
84+ 'no_homoglyph_names ' => true ,
85+ 'no_leading_import_slash ' => true ,
86+ 'no_leading_namespace_whitespace ' => true ,
87+ 'no_mixed_echo_print ' => true ,
88+ 'no_multiline_whitespace_around_double_arrow ' => true ,
89+ 'no_multiline_whitespace_before_semicolons ' => true ,
90+ 'non_printable_character ' => true ,
91+ 'no_null_property_initialization ' => true ,
92+ 'no_php4_constructor ' => true ,
93+ 'normalize_index_brace ' => true ,
94+ 'no_short_bool_cast ' => true ,
95+ 'no_short_echo_tag ' => true ,
96+ 'no_singleline_whitespace_before_semicolons ' => true ,
97+ 'no_spaces_after_function_name ' => true ,
98+ 'no_spaces_around_offset ' => true ,
99+ 'no_spaces_inside_parenthesis ' => true ,
100+ 'no_superfluous_elseif ' => true ,
101+ 'not_operator_with_space ' => false , // No we prefer to keep '!' without spaces
102+ 'not_operator_with_successor_space ' => false , // idem
103+ 'no_trailing_comma_in_list_call ' => true ,
104+ 'no_trailing_comma_in_singleline_array ' => true ,
105+ 'no_trailing_whitespace_in_comment ' => true ,
106+ 'no_trailing_whitespace ' => true ,
107+ 'no_unneeded_control_parentheses ' => true ,
108+ 'no_unneeded_curly_braces ' => true ,
109+ 'no_unneeded_final_method ' => true ,
110+ 'no_unreachable_default_argument_value ' => true ,
111+ 'no_unused_imports ' => true ,
112+ 'no_useless_else ' => true ,
113+ 'no_useless_return ' => true ,
114+ 'no_whitespace_before_comma_in_array ' => true ,
115+ 'no_whitespace_in_blank_line ' => true ,
116+ 'object_operator_without_whitespace ' => true ,
117+ 'ordered_class_elements ' => false , // We prefer to keep some freedom
118+ 'ordered_imports ' => true ,
119+ 'phpdoc_add_missing_param_annotation ' => true ,
120+ 'phpdoc_align ' => false , // Waste of time
121+ 'phpdoc_annotation_without_dot ' => true ,
122+ 'phpdoc_indent ' => true ,
123+ 'phpdoc_inline_tag ' => true ,
124+ 'phpdoc_no_access ' => true ,
125+ 'phpdoc_no_alias_tag ' => true ,
126+ 'phpdoc_no_empty_return ' => true ,
127+ 'phpdoc_no_package ' => true ,
128+ 'phpdoc_no_useless_inheritdoc ' => true ,
129+ 'phpdoc_order ' => true ,
130+ 'phpdoc_return_self_reference ' => true ,
131+ 'phpdoc_scalar ' => true ,
132+ 'phpdoc_separation ' => true ,
133+ 'phpdoc_single_line_var_spacing ' => true ,
134+ 'phpdoc_summary ' => false , // We usually don't generate documentation so punctuation is not important
135+ 'phpdoc_to_comment ' => true ,
136+ 'phpdoc_trim ' => true ,
137+ 'phpdoc_types_order ' => true ,
138+ 'phpdoc_types ' => true ,
139+ 'phpdoc_var_without_name ' => true ,
140+ 'php_unit_construct ' => true ,
141+ 'php_unit_dedicate_assert ' => true ,
142+ 'php_unit_expectation ' => true ,
143+ 'php_unit_fqcn_annotation ' => true ,
144+ 'php_unit_mock ' => true ,
145+ 'php_unit_namespaced ' => true ,
146+ 'php_unit_no_expectation_annotation ' => true ,
147+ 'php_unit_strict ' => false , // We sometime actually need assertEquals
148+ 'php_unit_test_annotation ' => true ,
149+ 'php_unit_test_class_requires_covers ' => false , // We don't care as much as we should about coverage
150+ 'pow_to_exponentiation ' => true ,
151+ 'protected_to_private ' => true ,
152+ 'psr0 ' => true ,
153+ 'psr4 ' => true ,
154+ 'random_api_migration ' => true ,
155+ 'return_type_declaration ' => true ,
156+ 'self_accessor ' => true ,
157+ 'semicolon_after_instruction ' => false , // We prefer to keep .phtml files without semicolon
158+ 'short_scalar_cast ' => true ,
159+ 'silenced_deprecation_error ' => true ,
160+ 'simplified_null_return ' => false , // Even if technically correct we prefer to be explicit
161+ 'single_blank_line_at_eof ' => true ,
162+ 'single_blank_line_before_namespace ' => true ,
163+ 'single_class_element_per_statement ' => true ,
164+ 'single_import_per_statement ' => true ,
165+ 'single_line_after_imports ' => true ,
166+ 'single_line_comment_style ' => true ,
167+ 'single_quote ' => true ,
168+ 'space_after_semicolon ' => true ,
169+ 'standardize_not_equals ' => true ,
170+ 'static_lambda ' => false , // Risky if we can't guarantee nobody use `bindTo()`
171+ 'strict_comparison ' => true ,
172+ 'strict_param ' => true ,
173+ 'switch_case_semicolon_to_colon ' => true ,
174+ 'switch_case_space ' => true ,
175+ 'ternary_operator_spaces ' => true ,
176+ 'ternary_to_null_coalescing ' => true ,
177+ 'trailing_comma_in_multiline_array ' => true ,
178+ 'trim_array_spaces ' => true ,
179+ 'unary_operator_spaces ' => true ,
180+ 'visibility_required ' => true ,
181+ 'void_return ' => true ,
182+ 'whitespace_after_comma_in_array ' => true ,
183+ 'yoda_style ' => false ,
174184 ]);
0 commit comments