|
| 1 | +<?php |
| 2 | + # PHPCS Fixer modified for Laravel Pint standards |
| 3 | + |
| 4 | + declare(strict_types=1); |
| 5 | + |
| 6 | + use PhpCsFixer\Config; |
| 7 | + use PhpCsFixer\Finder; |
| 8 | + |
| 9 | + $rules = [ |
| 10 | + 'array_indentation' => true, |
| 11 | + 'array_syntax' => ['syntax' => 'short'], |
| 12 | + 'binary_operator_spaces' => [ |
| 13 | + 'default' => 'single_space', |
| 14 | + ], |
| 15 | + 'blank_line_after_namespace' => true, |
| 16 | + 'blank_line_after_opening_tag' => true, |
| 17 | + 'blank_line_before_statement' => [ |
| 18 | + 'statements' => [ |
| 19 | + 'continue', |
| 20 | + 'return', |
| 21 | + ], |
| 22 | + ], |
| 23 | + 'blank_line_between_import_groups' => true, |
| 24 | + 'blank_lines_before_namespace' => true, |
| 25 | + 'braces_position' => [ |
| 26 | + 'control_structures_opening_brace' => 'same_line', |
| 27 | + 'functions_opening_brace' => 'next_line_unless_newline_at_signature_end', |
| 28 | + 'anonymous_functions_opening_brace' => 'same_line', |
| 29 | + 'classes_opening_brace' => 'next_line_unless_newline_at_signature_end', |
| 30 | + 'anonymous_classes_opening_brace' => 'next_line_unless_newline_at_signature_end', |
| 31 | + 'allow_single_line_empty_anonymous_classes' => false, |
| 32 | + 'allow_single_line_anonymous_functions' => false, |
| 33 | + ], |
| 34 | + 'cast_spaces' => true, |
| 35 | + 'class_attributes_separation' => [ |
| 36 | + 'elements' => [ |
| 37 | + 'const' => 'one', |
| 38 | + 'method' => 'one', |
| 39 | + 'property' => 'one', |
| 40 | + 'trait_import' => 'none', |
| 41 | + ], |
| 42 | + ], |
| 43 | + 'class_definition' => [ |
| 44 | + 'multi_line_extends_each_single_line' => true, |
| 45 | + 'single_item_single_line' => true, |
| 46 | + 'single_line' => true, |
| 47 | + ], |
| 48 | + 'class_reference_name_casing' => true, |
| 49 | + 'clean_namespace' => true, |
| 50 | + 'compact_nullable_type_declaration' => true, |
| 51 | + 'concat_space' => [ |
| 52 | + 'spacing' => 'none', |
| 53 | + ], |
| 54 | + 'constant_case' => ['case' => 'lower'], |
| 55 | + 'control_structure_braces' => true, |
| 56 | + 'control_structure_continuation_position' => [ |
| 57 | + 'position' => 'same_line', |
| 58 | + ], |
| 59 | + 'declare_equal_normalize' => true, |
| 60 | + 'declare_parentheses' => true, |
| 61 | + 'elseif' => true, |
| 62 | + 'encoding' => true, |
| 63 | + 'full_opening_tag' => true, |
| 64 | + 'fully_qualified_strict_types' => false, |
| 65 | + 'function_declaration' => true, |
| 66 | + 'general_phpdoc_tag_rename' => true, |
| 67 | + 'heredoc_to_nowdoc' => true, |
| 68 | + 'include' => true, |
| 69 | + 'increment_style' => ['style' => 'post'], |
| 70 | + 'indentation_type' => true, |
| 71 | + 'integer_literal_case' => true, |
| 72 | + 'lambda_not_used_import' => true, |
| 73 | + 'line_ending' => true, |
| 74 | + 'linebreak_after_opening_tag' => true, |
| 75 | + 'list_syntax' => true, |
| 76 | + 'lowercase_cast' => true, |
| 77 | + 'lowercase_keywords' => true, |
| 78 | + 'lowercase_static_reference' => true, |
| 79 | + 'magic_constant_casing' => true, |
| 80 | + 'magic_method_casing' => true, |
| 81 | + 'method_argument_space' => [ |
| 82 | + 'on_multiline' => 'ignore', |
| 83 | + ], |
| 84 | + 'method_chaining_indentation' => true, |
| 85 | + 'multiline_whitespace_before_semicolons' => [ |
| 86 | + 'strategy' => 'no_multi_line', |
| 87 | + ], |
| 88 | + 'native_function_casing' => true, |
| 89 | + 'native_type_declaration_casing' => true, |
| 90 | + 'no_alias_functions' => true, |
| 91 | + 'no_alias_language_construct_call' => true, |
| 92 | + 'no_alternative_syntax' => true, |
| 93 | + 'no_binary_string' => true, |
| 94 | + 'no_blank_lines_after_class_opening' => true, |
| 95 | + 'no_blank_lines_after_phpdoc' => true, |
| 96 | + 'no_closing_tag' => true, |
| 97 | + 'no_empty_phpdoc' => true, |
| 98 | + 'no_empty_statement' => true, |
| 99 | + 'no_extra_blank_lines' => [ |
| 100 | + 'tokens' => [ |
| 101 | + 'extra', |
| 102 | + 'throw', |
| 103 | + 'use', |
| 104 | + ], |
| 105 | + ], |
| 106 | + 'no_leading_import_slash' => true, |
| 107 | + 'no_leading_namespace_whitespace' => true, |
| 108 | + 'no_mixed_echo_print' => [ |
| 109 | + 'use' => 'echo', |
| 110 | + ], |
| 111 | + 'no_multiline_whitespace_around_double_arrow' => true, |
| 112 | + 'no_multiple_statements_per_line' => true, |
| 113 | + 'no_short_bool_cast' => true, |
| 114 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 115 | + 'no_space_around_double_colon' => true, |
| 116 | + 'no_spaces_after_function_name' => true, |
| 117 | + 'no_spaces_around_offset' => [ |
| 118 | + 'positions' => ['inside', 'outside'], |
| 119 | + ], |
| 120 | + 'no_superfluous_phpdoc_tags' => [ |
| 121 | + 'allow_mixed' => true, |
| 122 | + 'allow_unused_params' => true, |
| 123 | + ], |
| 124 | + 'no_trailing_comma_in_singleline' => true, |
| 125 | + 'no_trailing_whitespace' => true, |
| 126 | + 'no_trailing_whitespace_in_comment' => true, |
| 127 | + 'no_unneeded_control_parentheses' => [ |
| 128 | + 'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield'], |
| 129 | + ], |
| 130 | + 'no_unneeded_braces' => true, |
| 131 | + 'no_unreachable_default_argument_value' => true, |
| 132 | + 'no_unset_cast' => true, |
| 133 | + 'no_unused_imports' => true, |
| 134 | + 'no_useless_return' => true, |
| 135 | + 'no_whitespace_before_comma_in_array' => true, |
| 136 | + 'no_whitespace_in_blank_line' => true, |
| 137 | + 'normalize_index_brace' => true, |
| 138 | + 'not_operator_with_successor_space' => true, |
| 139 | + 'nullable_type_declaration' => true, |
| 140 | + 'nullable_type_declaration_for_default_null_value' => true, |
| 141 | + 'object_operator_without_whitespace' => true, |
| 142 | + 'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['const', 'class', 'function']], |
| 143 | + 'ordered_interfaces' => true, |
| 144 | + 'ordered_traits' => true, |
| 145 | + 'phpdoc_align' => [ |
| 146 | + 'align' => 'left', |
| 147 | + 'spacing' => [ |
| 148 | + 'param' => 2, |
| 149 | + ], |
| 150 | + ], |
| 151 | + 'phpdoc_indent' => true, |
| 152 | + 'phpdoc_inline_tag_normalizer' => true, |
| 153 | + 'phpdoc_no_access' => true, |
| 154 | + 'phpdoc_no_package' => true, |
| 155 | + 'phpdoc_no_useless_inheritdoc' => true, |
| 156 | + 'phpdoc_order' => [ |
| 157 | + 'order' => ['param', 'return', 'throws'], |
| 158 | + ], |
| 159 | + 'phpdoc_scalar' => true, |
| 160 | + 'phpdoc_separation' => [ |
| 161 | + 'groups' => [ |
| 162 | + ['deprecated', 'link', 'see', 'since'], |
| 163 | + ['author', 'copyright', 'license'], |
| 164 | + ['category', 'package', 'subpackage'], |
| 165 | + ['property', 'property-read', 'property-write'], |
| 166 | + ['param', 'return'], |
| 167 | + ], |
| 168 | + ], |
| 169 | + 'phpdoc_single_line_var_spacing' => true, |
| 170 | + 'phpdoc_summary' => false, |
| 171 | + 'phpdoc_tag_type' => [ |
| 172 | + 'tags' => [ |
| 173 | + 'inheritdoc' => 'inline', |
| 174 | + ], |
| 175 | + ], |
| 176 | + 'phpdoc_to_comment' => false, |
| 177 | + 'phpdoc_trim' => true, |
| 178 | + 'phpdoc_types' => true, |
| 179 | + 'phpdoc_var_without_name' => true, |
| 180 | + 'psr_autoloading' => false, |
| 181 | + 'return_type_declaration' => ['space_before' => 'none'], |
| 182 | + 'self_accessor' => false, |
| 183 | + 'self_static_accessor' => true, |
| 184 | + 'short_scalar_cast' => true, |
| 185 | + 'simplified_null_return' => false, |
| 186 | + 'single_blank_line_at_eof' => true, |
| 187 | + 'single_class_element_per_statement' => [ |
| 188 | + 'elements' => ['const', 'property'], |
| 189 | + ], |
| 190 | + 'single_import_per_statement' => true, |
| 191 | + 'single_line_after_imports' => true, |
| 192 | + 'single_line_comment_style' => [ |
| 193 | + 'comment_types' => ['hash'], |
| 194 | + ], |
| 195 | + 'single_line_empty_body' => true, |
| 196 | + 'single_quote' => true, |
| 197 | + 'single_space_around_construct' => true, |
| 198 | + 'space_after_semicolon' => true, |
| 199 | + 'spaces_inside_parentheses' => true, |
| 200 | + 'standardize_not_equals' => true, |
| 201 | + 'statement_indentation' => true, |
| 202 | + 'switch_case_semicolon_to_colon' => true, |
| 203 | + 'switch_case_space' => true, |
| 204 | + 'ternary_operator_spaces' => true, |
| 205 | + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], |
| 206 | + 'trim_array_spaces' => true, |
| 207 | + 'type_declaration_spaces' => true, |
| 208 | + 'types_spaces' => true, |
| 209 | + 'unary_operator_spaces' => true, |
| 210 | + 'visibility_required' => [ |
| 211 | + 'elements' => ['method', 'property'], |
| 212 | + ], |
| 213 | + 'whitespace_after_comma_in_array' => true, |
| 214 | + 'yoda_style' => [ |
| 215 | + 'always_move_variable' => false, |
| 216 | + 'equal' => false, |
| 217 | + 'identical' => false, |
| 218 | + 'less_and_greater' => false, |
| 219 | + ], |
| 220 | + 'declare_strict_types' => true, |
| 221 | + 'explicit_string_variable' => true, |
| 222 | + ]; |
| 223 | + |
| 224 | + $finder = Finder::create() |
| 225 | + ->in([ |
| 226 | + __DIR__.'/src', |
| 227 | + __DIR__.'/tests', |
| 228 | + ]) |
| 229 | + ->name('*.php') |
| 230 | + ->notName('*.blade.php') |
| 231 | + ->ignoreDotFiles(true) |
| 232 | + ->ignoreVCS(true); |
| 233 | + |
| 234 | + $config = new Config(); |
| 235 | + |
| 236 | + return $config->setFinder($finder) |
| 237 | + ->setRules($rules) |
| 238 | + ->setRiskyAllowed(true) |
| 239 | + ->setUsingCache(true); |
0 commit comments