|
| 1 | +<?php |
| 2 | + |
| 3 | +if (!file_exists(__DIR__ . '/src')) |
| 4 | +{ |
| 5 | + exit(0); |
| 6 | +} |
| 7 | + |
| 8 | +return (new PhpCsFixer\Config()) |
| 9 | + ->setRules([ |
| 10 | + '@Symfony' => true, |
| 11 | + '@Symfony:risky' => true, |
| 12 | + 'php_unit_dedicate_assert' => ['target' => '5.6'], |
| 13 | + 'array_syntax' => ['syntax' => 'short'], |
| 14 | + 'array_indentation' => true, |
| 15 | + 'binary_operator_spaces' => [ |
| 16 | + 'operators' => [ |
| 17 | + '=>' => 'align_single_space', |
| 18 | + ], |
| 19 | + ], |
| 20 | + 'concat_space' => [ |
| 21 | + 'spacing' => 'one', |
| 22 | + ], |
| 23 | + 'fopen_flags' => false, |
| 24 | + 'protected_to_private' => false, |
| 25 | + 'native_constant_invocation' => true, |
| 26 | + 'single_quote' => true, |
| 27 | + 'single_space_around_construct' => [ |
| 28 | + 'constructs_followed_by_a_single_space' => [ |
| 29 | + 'abstract', |
| 30 | + 'as', |
| 31 | + 'attribute', |
| 32 | + 'break', |
| 33 | + 'case', |
| 34 | + 'catch', |
| 35 | + 'class', |
| 36 | + 'clone', |
| 37 | + 'comment', |
| 38 | + 'const', |
| 39 | + 'const_import', |
| 40 | + 'continue', |
| 41 | + 'do', |
| 42 | + 'echo', |
| 43 | + 'else', |
| 44 | + 'elseif', |
| 45 | + 'enum', |
| 46 | + 'extends', |
| 47 | + 'final', |
| 48 | + 'finally', |
| 49 | + 'for', |
| 50 | + 'foreach', |
| 51 | + 'function', |
| 52 | + 'function_import', |
| 53 | + 'global', |
| 54 | + 'goto', |
| 55 | + 'if', |
| 56 | + 'implements', |
| 57 | + 'include', |
| 58 | + 'include_once', |
| 59 | + 'instanceof', |
| 60 | + 'insteadof', |
| 61 | + 'interface', |
| 62 | + 'match', |
| 63 | + 'named_argument', |
| 64 | + // 'namespace', // 兼容性移除 |
| 65 | + 'new', |
| 66 | + 'open_tag_with_echo', |
| 67 | + 'php_doc', |
| 68 | + 'php_open', |
| 69 | + 'print', |
| 70 | + 'private', |
| 71 | + 'protected', |
| 72 | + 'public', |
| 73 | + 'readonly', |
| 74 | + 'require', |
| 75 | + 'require_once', |
| 76 | + 'return', |
| 77 | + 'static', |
| 78 | + 'switch', |
| 79 | + 'throw', |
| 80 | + 'trait', |
| 81 | + 'try', |
| 82 | + 'type_colon', |
| 83 | + 'use', |
| 84 | + 'use_lambda', |
| 85 | + 'use_trait', |
| 86 | + 'var', |
| 87 | + 'while', |
| 88 | + 'yield', |
| 89 | + 'yield_from', |
| 90 | + ], |
| 91 | + ], |
| 92 | + 'control_structure_continuation_position' => [ |
| 93 | + 'position' => 'next_line', |
| 94 | + ], |
| 95 | + 'curly_braces_position' => [ |
| 96 | + 'control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end', |
| 97 | + ], |
| 98 | + 'no_superfluous_phpdoc_tags' => false, |
| 99 | + 'single_line_comment_style' => false, |
| 100 | + 'combine_nested_dirname' => false, |
| 101 | + 'backtick_to_shell_exec' => false, |
| 102 | + 'visibility_required' => false, |
| 103 | + ]) |
| 104 | + ->setRiskyAllowed(true) |
| 105 | + ->setFinder( |
| 106 | + PhpCsFixer\Finder::create() |
| 107 | + ->exclude(__DIR__ . '/vendor') |
| 108 | + ->in(__DIR__ . '/.github') |
| 109 | + ->in(__DIR__ . '/src') |
| 110 | + ->in(__DIR__ . '/examples') |
| 111 | + ->in(__DIR__ . '/tests') |
| 112 | + ->append([__FILE__]) |
| 113 | + ) |
| 114 | +; |
0 commit comments