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