Skip to content

Commit d159f63

Browse files
committed
Update PHP deps
1 parent ad979dd commit d159f63

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1069
-902
lines changed

.php-cs-fixer.dist.php

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$finder = PhpCsFixer\Finder::create()
6+
->exclude('library')
7+
->exclude('node_modules')
8+
->exclude('vendor')
9+
->name('*.phtml')
10+
->in(__DIR__);
11+
12+
return (new PhpCsFixer\Config())
13+
->setRiskyAllowed(true)
14+
->setFinder($finder)
15+
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__))
16+
->setRules([
17+
'align_multiline_comment' => true,
18+
'array_indentation' => true,
19+
'array_push' => true,
20+
'array_syntax' => ['syntax' => 'short'],
21+
'assign_null_coalescing_to_coalesce_equal' => true,
22+
'backtick_to_shell_exec' => false, // Backticks are a very concise way to execute shell
23+
'binary_operator_spaces' => true,
24+
'blank_line_after_namespace' => true,
25+
'blank_line_after_opening_tag' => true,
26+
'blank_line_before_statement' => true,
27+
'braces' => false, // Mess up our templates, eg: application/layouts/scripts/layout.phtml
28+
'cast_spaces' => true,
29+
'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']], // const are often grouped with other related const
30+
'class_definition' => true,
31+
'class_keyword_remove' => false, // Deprecated, and ::class keyword gives us better support in IDE
32+
'combine_consecutive_issets' => true,
33+
'combine_consecutive_unsets' => true,
34+
'combine_nested_dirname' => true,
35+
'comment_to_phpdoc' => true,
36+
'compact_nullable_typehint' => true,
37+
'concat_space' => ['spacing' => 'one'],
38+
'constant_case' => true,
39+
'control_structure_continuation_position' => true,
40+
'date_time_immutable' => true,
41+
'declare_equal_normalize' => true,
42+
'declare_parentheses' => true,
43+
'declare_strict_types' => false, // Too early to adopt strict types
44+
'dir_constant' => true,
45+
'doctrine_annotation_array_assignment' => true,
46+
'doctrine_annotation_braces' => true,
47+
'doctrine_annotation_indentation' => true,
48+
'doctrine_annotation_spaces' => true,
49+
'echo_tag_syntax' => true,
50+
'elseif' => true,
51+
'empty_loop_body' => true,
52+
'empty_loop_condition' => true,
53+
'encoding' => true,
54+
'ereg_to_preg' => true,
55+
'error_suppression' => true,
56+
'escape_implicit_backslashes' => true,
57+
'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read
58+
'explicit_string_variable' => false, // I feel it makes the code actually harder to read
59+
'final_class' => false, // We need non-final classes
60+
'final_internal_class' => true,
61+
'final_public_method_for_abstract_class' => false, // We need non-final methods
62+
'fopen_flag_order' => true,
63+
'fopen_flags' => true,
64+
'full_opening_tag' => true,
65+
'fully_qualified_strict_types' => true,
66+
'function_declaration' => true,
67+
'function_to_constant' => true,
68+
'function_typehint_space' => true,
69+
'general_phpdoc_annotation_remove' => ['annotations' => ['author', 'category', 'copyright', 'package', 'throws']],
70+
'general_phpdoc_tag_rename' => true,
71+
'global_namespace_import' => true,
72+
'group_import' => false, // I feel it makes the code actually harder to read
73+
'header_comment' => false, // We don't use common header in all our files
74+
'heredoc_indentation' => true,
75+
'heredoc_to_nowdoc' => false, // We often use variable in heredoc
76+
'implode_call' => true,
77+
'include' => true,
78+
'increment_style' => true,
79+
'indentation_type' => true,
80+
'integer_literal_case' => true,
81+
'is_null' => true,
82+
'lambda_not_used_import' => true,
83+
'line_ending' => true,
84+
'linebreak_after_opening_tag' => true,
85+
'list_syntax' => ['syntax' => 'short'],
86+
'logical_operators' => true,
87+
'lowercase_cast' => true,
88+
'lowercase_keywords' => true,
89+
'lowercase_static_reference' => true,
90+
'magic_constant_casing' => true,
91+
'magic_method_casing' => true,
92+
'mb_str_functions' => true,
93+
'method_argument_space' => true,
94+
'method_chaining_indentation' => true,
95+
'modernize_strpos' => true,
96+
'modernize_types_casting' => true,
97+
'multiline_comment_opening_closing' => true,
98+
'multiline_whitespace_before_semicolons' => true,
99+
'native_constant_invocation' => false, // Micro optimization that look messy
100+
'native_function_casing' => true,
101+
'native_function_invocation' => false, // I suppose this would be best, but I am still unconvinced about the visual aspect of it
102+
'native_function_type_declaration_casing' => true,
103+
'new_with_braces' => true,
104+
'no_alias_functions' => true,
105+
'no_alias_language_construct_call' => true,
106+
'no_alternative_syntax' => false, // We want to use alternative syntax in .phtml
107+
'no_binary_string' => true,
108+
'no_blank_lines_after_class_opening' => true,
109+
'no_blank_lines_after_phpdoc' => true,
110+
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
111+
'no_break_comment' => true,
112+
'no_closing_tag' => true,
113+
'no_empty_comment' => true,
114+
'no_empty_phpdoc' => true,
115+
'no_empty_statement' => true,
116+
'no_extra_blank_lines' => true,
117+
'no_homoglyph_names' => true,
118+
'no_leading_import_slash' => true,
119+
'no_leading_namespace_whitespace' => true,
120+
'no_mixed_echo_print' => true,
121+
'no_multiline_whitespace_around_double_arrow' => true,
122+
'no_null_property_initialization' => true,
123+
'no_php4_constructor' => false, // Because our BootstrapCli class is affected by https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/3096
124+
'no_short_bool_cast' => true,
125+
'no_singleline_whitespace_before_semicolons' => true,
126+
'no_space_around_double_colon' => true,
127+
'no_spaces_after_function_name' => true,
128+
'no_spaces_around_offset' => true,
129+
'no_spaces_inside_parenthesis' => true,
130+
'no_superfluous_elseif' => true,
131+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
132+
'no_trailing_comma_in_list_call' => true,
133+
'no_trailing_comma_in_singleline_array' => true,
134+
'no_trailing_whitespace' => true,
135+
'no_trailing_whitespace_in_comment' => true,
136+
'no_trailing_whitespace_in_string' => false, // Too dangerous
137+
'no_unneeded_control_parentheses' => true,
138+
'no_unneeded_curly_braces' => true,
139+
'no_unneeded_final_method' => true,
140+
'no_unreachable_default_argument_value' => true,
141+
'no_unset_cast' => true,
142+
'no_unset_on_property' => true,
143+
'no_unused_imports' => true,
144+
'no_useless_else' => true,
145+
'no_useless_return' => true,
146+
'no_useless_sprintf' => true,
147+
'no_whitespace_before_comma_in_array' => true,
148+
'no_whitespace_in_blank_line' => true,
149+
'non_printable_character' => true,
150+
'normalize_index_brace' => true,
151+
'not_operator_with_space' => false, // No we prefer to keep '!' without spaces
152+
'not_operator_with_successor_space' => false, // idem
153+
'nullable_type_declaration_for_default_null_value' => true,
154+
'object_operator_without_whitespace' => true,
155+
'octal_notation' => true,
156+
'operator_linebreak' => true,
157+
'ordered_class_elements' => false, // We prefer to keep some freedom
158+
'ordered_imports' => true,
159+
'ordered_interfaces' => true,
160+
'ordered_traits' => true,
161+
'php_unit_construct' => true,
162+
'php_unit_dedicate_assert' => true,
163+
'php_unit_dedicate_assert_internal_type' => true,
164+
'php_unit_expectation' => true,
165+
'php_unit_fqcn_annotation' => true,
166+
'php_unit_internal_class' => false, // Because tests are excluded from package
167+
'php_unit_method_casing' => true,
168+
'php_unit_mock' => true,
169+
'php_unit_mock_short_will_return' => true,
170+
'php_unit_namespaced' => true,
171+
'php_unit_no_expectation_annotation' => true,
172+
'php_unit_set_up_tear_down_visibility' => true,
173+
'php_unit_size_class' => false, // That seems extra work to maintain for little benefits
174+
'php_unit_strict' => false, // We sometime actually need assertEquals
175+
'php_unit_test_annotation' => true,
176+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
177+
'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage
178+
'phpdoc_add_missing_param_annotation' => true,
179+
'phpdoc_align' => false, // Waste of time
180+
'phpdoc_annotation_without_dot' => true,
181+
'phpdoc_indent' => true,
182+
'phpdoc_inline_tag_normalizer' => true,
183+
'phpdoc_line_span' => true,
184+
'phpdoc_no_access' => true,
185+
'phpdoc_no_alias_tag' => true,
186+
'phpdoc_no_empty_return' => true,
187+
'phpdoc_no_package' => true,
188+
'phpdoc_no_useless_inheritdoc' => true,
189+
'phpdoc_order' => true,
190+
'phpdoc_order_by_value' => true,
191+
'phpdoc_return_self_reference' => true,
192+
'phpdoc_scalar' => true,
193+
'phpdoc_separation' => true,
194+
'phpdoc_single_line_var_spacing' => true,
195+
'phpdoc_summary' => true,
196+
'phpdoc_tag_casing' => true,
197+
'phpdoc_tag_type' => true,
198+
'phpdoc_to_comment' => true,
199+
'phpdoc_to_param_type' => false, // Because experimental, but interesting for one shot use
200+
'phpdoc_to_property_type' => false, // Because experimental, but interesting for one shot use
201+
'phpdoc_to_return_type' => false, // Because experimental, but interesting for one shot use
202+
'phpdoc_trim' => true,
203+
'phpdoc_trim_consecutive_blank_line_separation' => true,
204+
'phpdoc_types' => true,
205+
'phpdoc_types_order' => true,
206+
'phpdoc_var_annotation_correct_order' => true,
207+
'phpdoc_var_without_name' => true,
208+
'pow_to_exponentiation' => true,
209+
'protected_to_private' => true,
210+
'psr_autoloading' => false, // We unfortunately cannot be entirely PSR-0 compliant with ZF1 because of classes like Admin_ChapterController
211+
'random_api_migration' => true,
212+
'regular_callable_call' => true,
213+
'return_assignment' => false, // Sometimes useful for clarity or debug
214+
'return_type_declaration' => true,
215+
'self_accessor' => true,
216+
'self_static_accessor' => true,
217+
'semicolon_after_instruction' => false, // We prefer to keep .phtml files without semicolon
218+
'set_type_to_cast' => true,
219+
'short_scalar_cast' => true,
220+
'simple_to_complex_string_variable' => false, // Would differ from TypeScript without obvious advantages
221+
'simplified_if_return' => false, // Even if technically correct we prefer to be explicit
222+
'simplified_null_return' => false, // Even if technically correct we prefer to be explicit
223+
'single_blank_line_at_eof' => true,
224+
'single_blank_line_before_namespace' => true,
225+
'single_class_element_per_statement' => true,
226+
'single_import_per_statement' => true,
227+
'single_line_after_imports' => true,
228+
'single_line_comment_style' => true,
229+
'single_line_throw' => false, // I don't see any reason for having a special case for Exception
230+
'single_quote' => true,
231+
'single_space_after_construct' => true,
232+
'single_trait_insert_per_statement' => true,
233+
'space_after_semicolon' => true,
234+
'standardize_increment' => true,
235+
'standardize_not_equals' => true,
236+
'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()`
237+
'strict_comparison' => false, // We sometimes need to compare DateTime objects with non-strict operator
238+
'strict_param' => false, // No, too dangerous to change that
239+
'string_length_to_empty' => true,
240+
'string_line_ending' => true,
241+
'switch_case_semicolon_to_colon' => true,
242+
'switch_case_space' => true,
243+
'switch_continue_to_break' => true,
244+
'ternary_operator_spaces' => true,
245+
'ternary_to_elvis_operator' => true,
246+
'ternary_to_null_coalescing' => true,
247+
'trailing_comma_in_multiline' => true,
248+
'trim_array_spaces' => true,
249+
'types_spaces' => true,
250+
'unary_operator_spaces' => true,
251+
'use_arrow_functions' => true,
252+
'visibility_required' => true,
253+
'void_return' => true,
254+
'whitespace_after_comma_in_array' => true,
255+
'yoda_style' => false,
256+
]);

0 commit comments

Comments
 (0)