|
| 1 | +<?php |
| 2 | +use PhpCsFixer\Finder; |
| 3 | +use PhpCsFixer\Config; |
| 4 | + |
| 5 | +$directories = ['storage', 'assets', 'vendor']; |
| 6 | +$files = ['*.blade.php', '*.bc.php', '_ide_helper.php', '*.phar']; |
| 7 | + |
| 8 | +$rules = [ |
| 9 | + '@PSR2' => true, |
| 10 | + 'array_syntax' => ['syntax' => 'short'], |
| 11 | + 'binary_operator_spaces' => ['align_equals' => false, 'align_double_arrow' => false], |
| 12 | + 'class_keyword_remove' => true, |
| 13 | + 'cast_spaces' => true, |
| 14 | + 'combine_consecutive_unsets' => true, |
| 15 | + 'concat_space' => ['spacing' => 'none'], |
| 16 | + 'dir_constant' => true, |
| 17 | + 'elseif' => true, |
| 18 | + 'explicit_indirect_variable' => true, |
| 19 | + 'full_opening_tag' => true, |
| 20 | + 'hash_to_slash_comment' => true, |
| 21 | + 'heredoc_to_nowdoc' => true, |
| 22 | + 'include' => true, |
| 23 | + 'linebreak_after_opening_tag' => true, |
| 24 | + 'list_syntax' => ['syntax' => 'long'], |
| 25 | + 'lowercase_cast' => true, |
| 26 | + 'lowercase_constants' => true, |
| 27 | + 'lowercase_keywords' => true, |
| 28 | + 'method_argument_space' => ['ensure_fully_multiline' => false], |
| 29 | + 'method_chaining_indentation' => true, |
| 30 | + 'method_separation' => true, |
| 31 | + 'modernize_types_casting' => true, |
| 32 | + 'normalize_index_brace' => true, |
| 33 | + 'new_with_braces' => true, |
| 34 | + 'no_blank_lines_after_class_opening' => true, |
| 35 | + 'no_blank_lines_after_phpdoc' => true, |
| 36 | + 'single_blank_line_before_namespace' => false, |
| 37 | + 'no_blank_lines_after_class_opening' => true, |
| 38 | + 'no_blank_lines_after_phpdoc' => true, |
| 39 | + 'no_break_comment' => false, |
| 40 | + 'no_closing_tag' => true, |
| 41 | + 'no_empty_comment' => true, |
| 42 | + 'no_empty_statement' => true, |
| 43 | + 'no_extra_consecutive_blank_lines' => true, |
| 44 | + 'no_leading_import_slash' => true, |
| 45 | + 'no_mixed_echo_print' => ['use' => 'echo'], |
| 46 | + 'no_null_property_initialization' => true, |
| 47 | + 'no_short_echo_tag' => true, |
| 48 | + 'no_spaces_around_offset' => true, |
| 49 | + 'no_spaces_inside_parenthesis' => true, |
| 50 | + 'no_trailing_comma_in_singleline_array' => true, |
| 51 | + 'no_trailing_whitespace' => true, |
| 52 | + 'no_trailing_whitespace_in_comment' => true, |
| 53 | + 'no_unused_imports' => true, |
| 54 | + 'no_useless_else' => true, |
| 55 | + 'no_useless_return' => true, |
| 56 | + 'no_whitespace_in_blank_line' => true, |
| 57 | + 'no_whitespace_before_comma_in_array' => true, |
| 58 | + 'no_whitespace_in_blank_line' => true, |
| 59 | + 'not_operator_with_successor_space' => true, |
| 60 | + 'phpdoc_align' => true, |
| 61 | + 'phpdoc_indent' => true, |
| 62 | + 'phpdoc_order' => true, |
| 63 | + 'phpdoc_separation' => true, |
| 64 | + 'phpdoc_single_line_var_spacing' => true, |
| 65 | + 'phpdoc_summary' => true, |
| 66 | + 'phpdoc_to_comment' => true, |
| 67 | + 'phpdoc_trim' => true, |
| 68 | + 'phpdoc_var_without_name' => true, |
| 69 | + 'semicolon_after_instruction' => true, |
| 70 | + 'short_scalar_cast' => true, |
| 71 | + 'simplified_null_return' => true, |
| 72 | + 'single_blank_line_at_eof' => true, |
| 73 | + 'single_import_per_statement' => true, |
| 74 | + 'single_quote' => true, |
| 75 | + 'standardize_not_equals' => true, |
| 76 | + 'switch_case_space' => false, |
| 77 | + 'ternary_operator_spaces' => true, |
| 78 | + 'ternary_to_null_coalescing' => false, |
| 79 | + 'trailing_comma_in_multiline_array' => true, |
| 80 | + 'trim_array_spaces' => true, |
| 81 | + 'unary_operator_spaces' => true, |
| 82 | +]; |
| 83 | + |
| 84 | +$finder = Finder::create() |
| 85 | + ->in(__DIR__) |
| 86 | + ->exclude($directories); |
| 87 | + |
| 88 | +foreach ($files as $file) { |
| 89 | + $finder->notName($file); |
| 90 | +} |
| 91 | + |
| 92 | +return Config::create() |
| 93 | + ->setRiskyAllowed(true) |
| 94 | + ->setRules($rules) |
| 95 | + ->setUsingCache(false) |
| 96 | + ->setFinder($finder); |
0 commit comments