| 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, |
| 11 | |
| 12 | 'array_push' => true, |
| 13 | 'backtick_to_shell_exec' => true, |
| 14 | 'no_alias_language_construct_call' => true, |
| 15 | 'no_mixed_echo_print' => true, |
| 16 | 'pow_to_exponentiation' => true, |
| 17 | 'random_api_migration' => true, |
| 18 | |
| 19 | 'array_syntax' => ['syntax' => 'short'], |
| 20 | 'no_multiline_whitespace_around_double_arrow' => true, |
| 21 | 'no_trailing_comma_in_singleline_array' => true, |
| 22 | 'no_whitespace_before_comma_in_array' => true, |
| 23 | 'normalize_index_brace' => true, |
| 24 | 'trailing_comma_in_multiline_array' => true, |
| 25 | 'whitespace_after_comma_in_array' => true, |
| 26 | |
| 27 | 'non_printable_character' => ['use_escape_sequences_in_strings' => true], |
| 28 | |
| 29 | 'lowercase_static_reference' => true, |
| 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'], |
| 36 | 'lowercase_cast' => true, |
| 37 | 'no_unset_cast' => true, |
| 38 | 'short_scalar_cast' => true, |
| 39 | |
| 40 | 'class_attributes_separation' => true, |
| 41 | 'no_blank_lines_after_class_opening' => true, |
| 42 | 'no_null_property_initialization' => true, |
| 43 | 'self_accessor' => true, |
| 44 | 'single_class_element_per_statement' => true, |
| 45 | 'single_trait_insert_per_statement' => true, |
| 46 | |
| 47 | 'no_empty_comment' => true, |
| 48 | 'single_line_comment_style' => ['comment_types' => ['hash']], |
| 49 | |
| 50 | 'native_constant_invocation' => true, |
| 51 | |
| 52 | 'no_alternative_syntax' => true, |
| 53 | 'no_trailing_comma_in_list_call' => true, |
| 54 | 'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield', 'yield_from']], |
| 55 | 'no_unneeded_curly_braces' => ['namespaces' => true], |
| 56 | 'switch_continue_to_break' => true, |
| 57 | |
| 58 | 'function_typehint_space' => true, |
| 59 | 'lambda_not_used_import' => true, |
| 60 | 'native_function_invocation' => true, |
| 61 | 'no_unreachable_default_argument_value' => true, |
| 62 | 'nullable_type_declaration_for_default_null_value' => true, |
| 63 | 'return_type_declaration' => true, |
| 64 | 'static_lambda' => true, |
| 65 | |
| 66 | 'fully_qualified_strict_types' => true, |
| 67 | 'no_leading_import_slash' => true, |
| 68 | 'no_unused_imports' => true, |
| 69 | 'ordered_imports' => true, |
| 70 | |
| 71 | 'declare_equal_normalize' => true, |
| 72 | 'dir_constant' => true, |
| 73 | 'explicit_indirect_variable' => true, |
| 74 | 'function_to_constant' => true, |
| 75 | 'is_null' => true, |
| 76 | 'no_unset_on_property' => true, |
| 77 | |
| 78 | 'list_syntax' => ['syntax' => 'short'], |
| 79 | |
| 80 | 'clean_namespace' => true, |
| 81 | 'no_leading_namespace_whitespace' => true, |
| 82 | 'single_blank_line_before_namespace' => true, |
| 83 | |
| 84 | 'no_homoglyph_names' => true, |
| 85 | |
| 86 | 'binary_operator_spaces' => true, |
| 87 | 'concat_space' => ['spacing' => 'one'], |
| 88 | 'increment_style' => ['style' => 'post'], |
| 89 | 'logical_operators' => true, |
| 90 | 'object_operator_without_whitespace' => true, |
| 91 | 'operator_linebreak' => true, |
| 92 | 'standardize_increment' => true, |
| 93 | 'standardize_not_equals' => true, |
| 94 | 'ternary_operator_spaces' => true, |
| 95 | 'ternary_to_elvis_operator' => true, |
| 96 | 'ternary_to_null_coalescing' => true, |
| 97 | 'unary_operator_spaces' => true, |
| 98 | |
| 99 | 'no_useless_return' => true, |
| 100 | 'return_assignment' => true, |
| 101 | 'simplified_null_return' => true, |
| 102 | |
| 103 | 'multiline_whitespace_before_semicolons' => true, |
| 104 | 'no_empty_statement' => true, |
| 105 | 'no_singleline_whitespace_before_semicolons' => true, |
| 106 | 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], |
| 107 | |
| 108 | 'escape_implicit_backslashes' => true, |
| 109 | 'explicit_string_variable' => true, |
| 110 | 'heredoc_to_nowdoc' => true, |
| 111 | 'no_binary_string' => true, |
| 112 | 'simple_to_complex_string_variable' => true, |
| 113 | |
| 114 | 'array_indentation' => true, |
| 115 | 'blank_line_before_statement' => ['statements' => ['return', 'exit']], |
| 116 | 'compact_nullable_typehint' => true, |
| 117 | 'method_chaining_indentation' => true, |
| 118 | 'no_extra_blank_lines' => ['tokens' => ['case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw', 'use', 'use_trait']], |
| 119 | 'no_spaces_around_offset' => true, |
| 120 | ]) |
| 121 | ->setFinder($finder); |