Commit | Line | Data |
---|---|---|
a337ae31 TD |
1 | <?php |
2 | $finder = PhpCsFixer\Finder::create() | |
3 | ->exclude('*/vendor/*') | |
4 | ->in(__DIR__.'/files/'); | |
5 | ||
6 | return (new PhpCsFixer\Config()) | |
7 | ->setRiskyAllowed(true) | |
8 | ->setRules([ | |
9 | '@PSR1' => true, | |
10 | '@PSR2' => true, | |
55e04a7c TD |
11 | '@PSR12' => true, |
12 | '@PER' => true, | |
a337ae31 TD |
13 | |
14 | 'array_push' => true, | |
15 | 'backtick_to_shell_exec' => true, | |
16 | 'no_alias_language_construct_call' => true, | |
17 | 'no_mixed_echo_print' => true, | |
18 | 'pow_to_exponentiation' => true, | |
19 | 'random_api_migration' => true, | |
20 | ||
21 | 'array_syntax' => ['syntax' => 'short'], | |
22 | 'no_multiline_whitespace_around_double_arrow' => true, | |
23 | 'no_trailing_comma_in_singleline_array' => true, | |
24 | 'no_whitespace_before_comma_in_array' => true, | |
25 | 'normalize_index_brace' => true, | |
a337ae31 TD |
26 | 'whitespace_after_comma_in_array' => true, |
27 | ||
28 | 'non_printable_character' => ['use_escape_sequences_in_strings' => true], | |
29 | ||
a337ae31 TD |
30 | 'magic_constant_casing' => true, |
31 | 'magic_method_casing' => true, | |
32 | 'native_function_casing' => true, | |
33 | 'native_function_type_declaration_casing' => true, | |
34 | ||
35 | 'cast_spaces' => ['space' => 'none'], | |
a337ae31 | 36 | 'no_unset_cast' => true, |
a337ae31 TD |
37 | |
38 | 'class_attributes_separation' => true, | |
a337ae31 TD |
39 | 'no_null_property_initialization' => true, |
40 | 'self_accessor' => true, | |
41 | 'single_class_element_per_statement' => true, | |
a337ae31 TD |
42 | |
43 | 'no_empty_comment' => true, | |
44 | 'single_line_comment_style' => ['comment_types' => ['hash']], | |
45 | ||
7f610ed5 | 46 | 'native_constant_invocation' => ['strict' => false], |
a337ae31 TD |
47 | |
48 | 'no_alternative_syntax' => true, | |
49 | 'no_trailing_comma_in_list_call' => true, | |
50 | 'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield', 'yield_from']], | |
51 | 'no_unneeded_curly_braces' => ['namespaces' => true], | |
52 | 'switch_continue_to_break' => true, | |
7f610ed5 | 53 | 'trailing_comma_in_multiline' => ['elements' => ['arrays']], |
a337ae31 TD |
54 | |
55 | 'function_typehint_space' => true, | |
56 | 'lambda_not_used_import' => true, | |
7f610ed5 | 57 | 'native_function_invocation' => ['include' => ['@internal']], |
a337ae31 TD |
58 | 'no_unreachable_default_argument_value' => true, |
59 | 'nullable_type_declaration_for_default_null_value' => true, | |
a337ae31 TD |
60 | 'static_lambda' => true, |
61 | ||
62 | 'fully_qualified_strict_types' => true, | |
a337ae31 TD |
63 | 'no_unused_imports' => true, |
64 | 'ordered_imports' => true, | |
65 | ||
a337ae31 TD |
66 | 'dir_constant' => true, |
67 | 'explicit_indirect_variable' => true, | |
68 | 'function_to_constant' => true, | |
69 | 'is_null' => true, | |
70 | 'no_unset_on_property' => true, | |
71 | ||
72 | 'list_syntax' => ['syntax' => 'short'], | |
73 | ||
74 | 'clean_namespace' => true, | |
75 | 'no_leading_namespace_whitespace' => true, | |
a337ae31 TD |
76 | |
77 | 'no_homoglyph_names' => true, | |
78 | ||
79 | 'binary_operator_spaces' => true, | |
80 | 'concat_space' => ['spacing' => 'one'], | |
81 | 'increment_style' => ['style' => 'post'], | |
82 | 'logical_operators' => true, | |
83 | 'object_operator_without_whitespace' => true, | |
84 | 'operator_linebreak' => true, | |
85 | 'standardize_increment' => true, | |
86 | 'standardize_not_equals' => true, | |
a337ae31 TD |
87 | 'ternary_to_elvis_operator' => true, |
88 | 'ternary_to_null_coalescing' => true, | |
89 | 'unary_operator_spaces' => true, | |
90 | ||
91 | 'no_useless_return' => true, | |
a337ae31 TD |
92 | |
93 | 'multiline_whitespace_before_semicolons' => true, | |
94 | 'no_empty_statement' => true, | |
95 | 'no_singleline_whitespace_before_semicolons' => true, | |
96 | 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], | |
97 | ||
98 | 'escape_implicit_backslashes' => true, | |
99 | 'explicit_string_variable' => true, | |
100 | 'heredoc_to_nowdoc' => true, | |
101 | 'no_binary_string' => true, | |
102 | 'simple_to_complex_string_variable' => true, | |
103 | ||
104 | 'array_indentation' => true, | |
105 | 'blank_line_before_statement' => ['statements' => ['return', 'exit']], | |
a337ae31 | 106 | 'method_chaining_indentation' => true, |
b9fb5588 | 107 | 'no_extra_blank_lines' => ['tokens' => ['case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw', 'use']], |
a337ae31 TD |
108 | 'no_spaces_around_offset' => true, |
109 | ]) | |
110 | ->setFinder($finder); |