| 1 |
<?php |
| 2 |
|
| 3 |
$finder = PhpCsFixer\Finder::create() |
| 4 |
->exclude( 'node_modules' ) |
| 5 |
->exclude( 'vendors' ) |
| 6 |
->in( __DIR__ ) |
| 7 |
; |
| 8 |
|
| 9 |
$config = PhpCsFixer\Config::create() |
| 10 |
->setRiskyAllowed( true ) |
| 11 |
->setUsingCache( false ) |
| 12 |
->setRules( [ |
| 13 |
'@PSR2' => true, |
| 14 |
'align_multiline_comment' => true, |
| 15 |
'array_syntax' => ['syntax' => 'short'], |
| 16 |
'binary_operator_spaces' => [ |
| 17 |
'align_double_arrow' => true, |
| 18 |
'align_equals' => true, |
| 19 |
], |
| 20 |
'blank_line_after_opening_tag' => true, |
| 21 |
'blank_line_before_statement' => [ |
| 22 |
'statements' => ['return', 'try', 'if', 'while', 'for', 'foreach', 'do', 'case'], |
| 23 |
], |
| 24 |
'braces' => [ |
| 25 |
'position_after_functions_and_oop_constructs' => 'same', |
| 26 |
'allow_single_line_closure' => false, |
| 27 |
], |
| 28 |
'cast_spaces' => ['space' => 'single'], |
| 29 |
'class_attributes_separation' => ['elements' => ['method', 'const', 'property']], |
| 30 |
'class_definition' => ['single_line' => true], |
| 31 |
'concat_space' => ['spacing' => 'one'], |
| 32 |
'constant_case' => ['case' => 'lower'], |
| 33 |
'dir_constant' => true, |
| 34 |
'elseif' => true, |
| 35 |
'full_opening_tag' => true, |
| 36 |
'fully_qualified_strict_types' => true, |
| 37 |
'function_declaration' => true, |
| 38 |
'space_inside_parenthesis' => true, |
| 39 |
'function_typehint_space' => true, |
| 40 |
'global_namespace_import' => ['import_classes' => true], |
| 41 |
'include' => true, |
| 42 |
'line_ending' => true, |
| 43 |
'list_syntax' => ['syntax' => 'long'], |
| 44 |
'lowercase_cast' => true, |
| 45 |
'lowercase_keywords' => true, |
| 46 |
'lowercase_static_reference' => true, |
| 47 |
'magic_constant_casing' => true, |
| 48 |
'magic_method_casing' => true, |
| 49 |
'method_argument_space' => true, |
| 50 |
'native_function_casing' => true, |
| 51 |
'method_chaining_indentation' => true, |
| 52 |
'native_function_type_declaration_casing' => true, |
| 53 |
'new_with_braces' => true, |
| 54 |
'no_alternative_syntax' => true, |
| 55 |
'no_blank_lines_before_namespace' => true, |
| 56 |
'no_blank_lines_after_class_opening' => false, |
| 57 |
'no_blank_lines_after_phpdoc' => true, |
| 58 |
'no_empty_comment' => true, |
| 59 |
'no_empty_phpdoc' => true, |
| 60 |
'no_empty_statement' => true, |
| 61 |
'no_extra_blank_lines' => ['tokens' => [ |
| 62 |
'extra', |
| 63 |
'parenthesis_brace_block', |
| 64 |
'square_brace_block', |
| 65 |
'throw', |
| 66 |
'use', |
| 67 |
]], |
| 68 |
'no_leading_import_slash' => true, |
| 69 |
'no_leading_namespace_whitespace' => true, |
| 70 |
'no_mixed_echo_print' => true, |
| 71 |
'no_multiline_whitespace_around_double_arrow' => true, |
| 72 |
'no_short_bool_cast' => true, |
| 73 |
'no_short_echo_tag' => true, |
| 74 |
'no_singleline_whitespace_before_semicolons' => true, |
| 75 |
'no_spaces_around_offset' => ['positions' => ['outside']], |
| 76 |
'no_spaces_inside_parenthesis' => false, |
| 77 |
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'allow_unused_params' => true], |
| 78 |
'no_trailing_comma_in_list_call' => true, |
| 79 |
'no_trailing_comma_in_singleline_array' => true, |
| 80 |
'no_trailing_whitespace' => true, |
| 81 |
'no_unneeded_control_parentheses' => true, |
| 82 |
'no_unneeded_curly_braces' => true, |
| 83 |
'no_unneeded_final_method' => true, |
| 84 |
'no_unused_imports' => true, |
| 85 |
'no_whitespace_before_comma_in_array' => true, |
| 86 |
'no_whitespace_in_blank_line' => true, |
| 87 |
'normalize_index_brace' => true, |
| 88 |
'object_operator_without_whitespace' => true, |
| 89 |
'ordered_imports' => true, |
| 90 |
'php_unit_fqcn_annotation' => true, |
| 91 |
'phpdoc_align' => [ |
| 92 |
'align' => 'vertical', |
| 93 |
'tags' => [ |
| 94 |
'method', |
| 95 |
'param', |
| 96 |
'property', |
| 97 |
'return', |
| 98 |
'throws', |
| 99 |
'type', |
| 100 |
'var', |
| 101 |
], |
| 102 |
], |
| 103 |
'phpdoc_annotation_without_dot' => true, |
| 104 |
'phpdoc_indent' => true, |
| 105 |
'phpdoc_inline_tag' => true, |
| 106 |
'phpdoc_no_access' => true, |
| 107 |
'phpdoc_no_alias_tag' => true, |
| 108 |
'phpdoc_no_package' => true, |
| 109 |
'phpdoc_no_useless_inheritdoc' => true, |
| 110 |
'phpdoc_return_self_reference' => true, |
| 111 |
'phpdoc_scalar' => true, |
| 112 |
'phpdoc_separation' => true, |
| 113 |
'phpdoc_single_line_var_spacing' => true, |
| 114 |
'phpdoc_to_comment' => true, |
| 115 |
'phpdoc_trim' => true, |
| 116 |
'phpdoc_trim_consecutive_blank_line_separation' => true, |
| 117 |
'phpdoc_types' => true, |
| 118 |
'phpdoc_types_order' => [ |
| 119 |
'null_adjustment' => 'always_last', |
| 120 |
'sort_algorithm' => 'none', |
| 121 |
], |
| 122 |
'phpdoc_var_without_name' => true, |
| 123 |
'return_type_declaration' => true, |
| 124 |
'semicolon_after_instruction' => true, |
| 125 |
'short_scalar_cast' => true, |
| 126 |
'single_class_element_per_statement' => true, |
| 127 |
'single_line_comment_style' => [ |
| 128 |
'comment_types' => ['hash'], |
| 129 |
], |
| 130 |
'single_line_throw' => true, |
| 131 |
'single_quote' => true, |
| 132 |
'single_trait_insert_per_statement' => true, |
| 133 |
'space_after_semicolon' => [ |
| 134 |
'remove_in_empty_for_expressions' => true, |
| 135 |
], |
| 136 |
'standardize_increment' => true, |
| 137 |
'standardize_not_equals' => true, |
| 138 |
'ternary_operator_spaces' => true, |
| 139 |
'trailing_comma_in_multiline_array' => true, |
| 140 |
'trim_array_spaces' => false, |
| 141 |
'unary_operator_spaces' => true, |
| 142 |
'whitespace_after_comma_in_array' => true, |
| 143 |
// 'yoda_style' => true, |
| 144 |
] ) |
| 145 |
->setFinder( $finder ) |
| 146 |
; |
| 147 |
|
| 148 |
return $config; |
| 149 |
|