|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of james.xue/sms-bombing. |
| 5 | + * |
| 6 | + * (c) xiaoxuan6 <[email protected]> |
| 7 | + * |
| 8 | + * This source file is subject to the MIT license that is bundled |
| 9 | + * with this source code in the file LICENSE. |
| 10 | + * |
| 11 | + */ |
| 12 | + |
| 13 | +$header = <<<HEADER |
| 14 | +This file is part of james.xue/sms-bombing. |
| 15 | +
|
| 16 | + |
| 17 | +
|
| 18 | +This source file is subject to the MIT license that is bundled |
| 19 | +with this source code in the file LICENSE. |
| 20 | +
|
| 21 | +HEADER; |
| 22 | + |
| 23 | +$finder = PhpCsFixer\Finder::create() |
| 24 | + ->in([ |
| 25 | + __DIR__ . '/app', |
| 26 | + __DIR__ . '/bootstrap', |
| 27 | + __DIR__ . '/config', |
| 28 | + ]) |
| 29 | + ->exclude([ |
| 30 | + __DIR__ . '/vendor', |
| 31 | + ]) |
| 32 | + ->name('*.php') |
| 33 | + ->name('code-explain') |
| 34 | + ->ignoreDotFiles(true) |
| 35 | + ->ignoreVCS(true); |
| 36 | + |
| 37 | +return (new PhpCsFixer\Config()) |
| 38 | + ->setRules([ |
| 39 | + '@PSR12' => true, |
| 40 | + 'header_comment' => ['header' => $header], |
| 41 | + 'array_syntax' => ['syntax' => 'short'], |
| 42 | + 'no_useless_else' => true, |
| 43 | + 'not_operator_with_successor_space' => true, |
| 44 | + 'phpdoc_scalar' => true, |
| 45 | + 'unary_operator_spaces' => true, |
| 46 | + 'binary_operator_spaces' => true, |
| 47 | + 'blank_line_before_statement' => [ |
| 48 | + 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], |
| 49 | + ], |
| 50 | + 'phpdoc_single_line_var_spacing' => true, |
| 51 | + 'phpdoc_var_without_name' => true, |
| 52 | + 'class_attributes_separation' => [ |
| 53 | + 'elements' => [ |
| 54 | + 'method' => 'one', |
| 55 | + ], |
| 56 | + ], |
| 57 | + 'method_argument_space' => [ |
| 58 | + 'on_multiline' => 'ensure_fully_multiline', |
| 59 | + 'keep_multiple_spaces_after_comma' => true, |
| 60 | + ], |
| 61 | + 'single_trait_insert_per_statement' => true, |
| 62 | + 'trim_array_spaces' => true, |
| 63 | + 'combine_consecutive_unsets' => true, |
| 64 | + 'concat_space' => ['spacing' => 'one'], |
| 65 | + 'new_with_braces' => true, |
| 66 | + 'no_space_around_double_colon' => true, |
| 67 | + 'object_operator_without_whitespace' => true, |
| 68 | + 'ternary_operator_spaces' => true, |
| 69 | + 'ternary_to_null_coalescing' => true, |
| 70 | + 'align_multiline_comment' => true, |
| 71 | + 'no_blank_lines_after_phpdoc' => true, |
| 72 | + 'no_useless_return' => true, |
| 73 | + 'return_assignment' => true, |
| 74 | + 'blank_line_after_namespace' => true, |
| 75 | + 'no_leading_namespace_whitespace' => true, |
| 76 | +// 'single_blank_line_before_namespace' => true, |
| 77 | + 'fully_qualified_strict_types' => true, |
| 78 | + 'global_namespace_import' => [ |
| 79 | + 'import_classes' => true, |
| 80 | + 'import_constants' => true, |
| 81 | + 'import_functions' => true |
| 82 | + ], |
| 83 | + 'group_import' => true, |
| 84 | + 'single_import_per_statement' => false, |
| 85 | + 'no_unused_imports' => true, |
| 86 | + 'ordered_imports' => [ |
| 87 | + 'sort_algorithm' => 'length', |
| 88 | + 'imports_order' => ['const', 'class', 'function'] |
| 89 | + ], |
| 90 | + 'single_line_after_imports' => true, |
| 91 | + 'blank_line_after_opening_tag' => true, |
| 92 | + 'compact_nullable_typehint' => true, |
| 93 | + 'declare_equal_normalize' => true, |
| 94 | + 'lowercase_cast' => true, |
| 95 | + 'lowercase_static_reference' => true, |
| 96 | + 'no_blank_lines_after_class_opening' => true, |
| 97 | + 'no_leading_import_slash' => true, |
| 98 | + 'no_whitespace_in_blank_line' => true, |
| 99 | + 'ordered_class_elements' => [ |
| 100 | + 'order' => [ |
| 101 | + 'use_trait', |
| 102 | + ], |
| 103 | + ], |
| 104 | + 'return_type_declaration' => true, |
| 105 | + 'short_scalar_cast' => true, |
| 106 | + 'visibility_required' => [ |
| 107 | + 'elements' => [ |
| 108 | + 'const', |
| 109 | + 'method', |
| 110 | + 'property', |
| 111 | + ], |
| 112 | + ], |
| 113 | + ]) |
| 114 | + ->setFinder($finder); |
0 commit comments