|
| 1 | +<?php |
| 2 | +$finder = PhpCsFixer\Finder::create() |
| 3 | + ->exclude('*/vendor/*') |
| 4 | + ->exclude('node_modules') |
| 5 | + ->in(__DIR__); |
| 6 | + |
| 7 | +return (new PhpCsFixer\Config()) |
| 8 | + ->setRiskyAllowed(true) |
| 9 | + ->setRules([ |
| 10 | + '@PSR1' => true, |
| 11 | + '@PSR2' => true, |
| 12 | + '@PSR12' => true, |
| 13 | + '@PER' => true, |
| 14 | + |
| 15 | + 'array_push' => true, |
| 16 | + 'backtick_to_shell_exec' => true, |
| 17 | + 'no_alias_language_construct_call' => true, |
| 18 | + 'no_mixed_echo_print' => true, |
| 19 | + 'pow_to_exponentiation' => true, |
| 20 | + 'random_api_migration' => true, |
| 21 | + |
| 22 | + 'array_syntax' => ['syntax' => 'short'], |
| 23 | + 'no_multiline_whitespace_around_double_arrow' => true, |
| 24 | + 'no_trailing_comma_in_singleline_array' => true, |
| 25 | + 'no_whitespace_before_comma_in_array' => true, |
| 26 | + 'normalize_index_brace' => true, |
| 27 | + 'whitespace_after_comma_in_array' => true, |
| 28 | + |
| 29 | + 'non_printable_character' => ['use_escape_sequences_in_strings' => true], |
| 30 | + |
| 31 | + 'magic_constant_casing' => true, |
| 32 | + 'magic_method_casing' => true, |
| 33 | + 'native_function_casing' => true, |
| 34 | + 'native_function_type_declaration_casing' => true, |
| 35 | + |
| 36 | + 'cast_spaces' => ['space' => 'none'], |
| 37 | + 'no_unset_cast' => true, |
| 38 | + |
| 39 | + 'class_attributes_separation' => true, |
| 40 | + 'no_null_property_initialization' => true, |
| 41 | + 'self_accessor' => true, |
| 42 | + 'single_class_element_per_statement' => true, |
| 43 | + |
| 44 | + 'no_empty_comment' => true, |
| 45 | + 'single_line_comment_style' => ['comment_types' => ['hash']], |
| 46 | + |
| 47 | + 'native_constant_invocation' => ['strict' => false], |
| 48 | + |
| 49 | + 'no_alternative_syntax' => true, |
| 50 | + 'no_trailing_comma_in_list_call' => true, |
| 51 | + 'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield', 'yield_from']], |
| 52 | + 'no_unneeded_curly_braces' => ['namespaces' => true], |
| 53 | + 'switch_continue_to_break' => true, |
| 54 | + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], |
| 55 | + |
| 56 | + 'function_typehint_space' => true, |
| 57 | + 'lambda_not_used_import' => true, |
| 58 | + 'native_function_invocation' => ['include' => ['@internal']], |
| 59 | + 'no_unreachable_default_argument_value' => true, |
| 60 | + 'nullable_type_declaration_for_default_null_value' => true, |
| 61 | + 'static_lambda' => true, |
| 62 | + |
| 63 | + 'fully_qualified_strict_types' => true, |
| 64 | + 'no_unused_imports' => true, |
| 65 | + |
| 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, |
| 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, |
| 87 | + 'ternary_to_elvis_operator' => true, |
| 88 | + 'ternary_to_null_coalescing' => true, |
| 89 | + 'unary_operator_spaces' => true, |
| 90 | + |
| 91 | + 'no_useless_return' => true, |
| 92 | + 'return_assignment' => true, |
| 93 | + |
| 94 | + 'multiline_whitespace_before_semicolons' => true, |
| 95 | + 'no_empty_statement' => true, |
| 96 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 97 | + 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], |
| 98 | + |
| 99 | + 'escape_implicit_backslashes' => true, |
| 100 | + 'explicit_string_variable' => true, |
| 101 | + 'heredoc_to_nowdoc' => true, |
| 102 | + 'no_binary_string' => true, |
| 103 | + 'simple_to_complex_string_variable' => true, |
| 104 | + |
| 105 | + 'array_indentation' => true, |
| 106 | + 'blank_line_before_statement' => ['statements' => ['return', 'exit']], |
| 107 | + 'method_chaining_indentation' => true, |
| 108 | + 'no_extra_blank_lines' => ['tokens' => ['case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw', 'use']], |
| 109 | + 'no_spaces_around_offset' => true, |
| 110 | + |
| 111 | + // SoftCreatR style |
| 112 | + 'global_namespace_import' => [ |
| 113 | + 'import_classes' => true, |
| 114 | + 'import_constants' => true, |
| 115 | + 'import_functions' => false, |
| 116 | + ], |
| 117 | + 'ordered_imports' => [ |
| 118 | + 'imports_order' => ['class', 'function', 'const'], |
| 119 | + ], |
| 120 | + ]) |
| 121 | + ->setFinder($finder); |
0 commit comments