|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use PhpCsFixer\Config; |
| 6 | +use PhpCsFixer\Finder; |
| 7 | + |
| 8 | +$finder = Finder::create() |
| 9 | + ->in(__DIR__) |
| 10 | + ->exclude([ |
| 11 | + 'media', |
| 12 | + 'tests', |
| 13 | + 'vendor', |
| 14 | + ]); |
| 15 | + |
| 16 | +$rules = [ |
| 17 | + '@PSR1' => true, |
| 18 | + '@PSR2' => true, |
| 19 | + |
| 20 | + 'align_multiline_comment' => true, |
| 21 | + 'array_indentation' => true, |
| 22 | + 'array_syntax' => [ |
| 23 | + 'syntax' => 'short', |
| 24 | + ], |
| 25 | + 'blank_line_after_opening_tag' => true, |
| 26 | + 'blank_line_before_statement' => [ |
| 27 | + 'statements' => ['return', 'throw'], |
| 28 | + ], |
| 29 | + 'cast_spaces' => [ |
| 30 | + 'space' => 'none', |
| 31 | + ], |
| 32 | + 'class_attributes_separation' => [ |
| 33 | + 'elements' => ['method', 'property'], |
| 34 | + ], |
| 35 | + 'combine_consecutive_issets' => true, |
| 36 | + 'combine_consecutive_unsets' => true, |
| 37 | + 'compact_nullable_typehint' => true, |
| 38 | + 'concat_space' => [ |
| 39 | + 'spacing' => 'one', |
| 40 | + ], |
| 41 | + 'declare_equal_normalize' => true, |
| 42 | + 'declare_strict_types' => true, |
| 43 | + 'ereg_to_preg' => true, |
| 44 | + 'fully_qualified_strict_types' => true, |
| 45 | + 'function_to_constant' => true, |
| 46 | + 'function_typehint_space' => true, |
| 47 | + 'heredoc_indentation' => true, |
| 48 | + 'heredoc_to_nowdoc' => true, |
| 49 | + 'list_syntax' => true, |
| 50 | + 'logical_operators' => true, |
| 51 | + 'lowercase_cast' => true, |
| 52 | + 'lowercase_static_reference' => true, |
| 53 | + 'magic_constant_casing' => true, |
| 54 | + 'magic_method_casing' => true, |
| 55 | + 'mb_str_functions' => true, |
| 56 | + 'method_chaining_indentation' => true, |
| 57 | + 'modernize_types_casting' => true, |
| 58 | + 'multiline_comment_opening_closing' => true, |
| 59 | + 'multiline_whitespace_before_semicolons' => true, |
| 60 | + 'native_function_casing' => true, |
| 61 | + 'native_function_type_declaration_casing' => true, |
| 62 | + 'new_with_braces' => true, |
| 63 | + 'no_alias_functions' => true, |
| 64 | + 'no_alternative_syntax' => true, |
| 65 | + 'no_blank_lines_after_class_opening' => true, |
| 66 | + 'no_blank_lines_after_phpdoc' => true, |
| 67 | + 'no_break_comment' => [ |
| 68 | + 'comment_text' => 'No break.', |
| 69 | + ], |
| 70 | + 'no_empty_phpdoc' => true, |
| 71 | + 'no_empty_statement' => true, |
| 72 | + 'no_extra_blank_lines' => true, |
| 73 | + 'no_leading_import_slash' => true, |
| 74 | + 'no_leading_namespace_whitespace' => true, |
| 75 | + 'no_mixed_echo_print' => true, |
| 76 | + 'no_multiline_whitespace_around_double_arrow' => true, |
| 77 | + 'no_php4_constructor' => true, |
| 78 | + 'no_short_bool_cast' => true, |
| 79 | + 'no_short_echo_tag' => true, |
| 80 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 81 | + 'no_spaces_around_offset' => true, |
| 82 | + 'no_unused_imports' => true, |
| 83 | + 'no_whitespace_before_comma_in_array' => true, |
| 84 | + 'no_whitespace_in_blank_line' => true, |
| 85 | + 'normalize_index_brace' => true, |
| 86 | + 'object_operator_without_whitespace' => true, |
| 87 | + 'ordered_imports' => true, |
| 88 | + 'phpdoc_add_missing_param_annotation' => true, |
| 89 | + 'phpdoc_align' => [ |
| 90 | + 'align' => 'left', |
| 91 | + ], |
| 92 | + 'phpdoc_annotation_without_dot' => true, |
| 93 | + 'phpdoc_indent' => true, |
| 94 | + 'phpdoc_no_empty_return' => true, |
| 95 | + 'phpdoc_no_package' => true, |
| 96 | + 'phpdoc_order' => true, |
| 97 | + 'phpdoc_scalar' => true, |
| 98 | + 'phpdoc_single_line_var_spacing' => true, |
| 99 | + 'phpdoc_summary' => true, |
| 100 | + 'phpdoc_trim' => true, |
| 101 | + 'phpdoc_trim_consecutive_blank_line_separation' => true, |
| 102 | + 'phpdoc_types' => true, |
| 103 | + 'phpdoc_types_order' => [ |
| 104 | + 'null_adjustment' => 'always_last', |
| 105 | + 'sort_algorithm' => 'none', |
| 106 | + ], |
| 107 | + 'phpdoc_var_annotation_correct_order' => true, |
| 108 | + 'phpdoc_var_without_name' => true, |
| 109 | + 'random_api_migration' => true, |
| 110 | + 'return_type_declaration' => true, |
| 111 | + 'semicolon_after_instruction' => true, |
| 112 | + 'set_type_to_cast' => true, |
| 113 | + 'short_scalar_cast' => true, |
| 114 | + 'simple_to_complex_string_variable' => true, |
| 115 | + 'simplified_null_return' => true, |
| 116 | + 'single_blank_line_before_namespace' => true, |
| 117 | + 'single_line_comment_style' => true, |
| 118 | + 'single_quote' => true, |
| 119 | + 'single_trait_insert_per_statement' => true, |
| 120 | + 'standardize_not_equals' => true, |
| 121 | + 'ternary_operator_spaces' => true, |
| 122 | + 'ternary_to_null_coalescing' => true, |
| 123 | + 'trailing_comma_in_multiline_array' => true, |
| 124 | + 'trim_array_spaces' => true, |
| 125 | + 'unary_operator_spaces' => true, |
| 126 | +]; |
| 127 | + |
| 128 | +return Config::create() |
| 129 | + ->setRules($rules) |
| 130 | + ->setFinder($finder); |
0 commit comments