|
| 1 | +<?php |
| 2 | +$header = <<<'EOF' |
| 3 | +@link http://www.yiiframework.com/ |
| 4 | +@copyright Copyright (c) 2008 Yii Software LLC |
| 5 | +@license http://www.yiiframework.com/license/ |
| 6 | +EOF; |
| 7 | + |
| 8 | +$finder = PhpCsFixer\Finder::create() |
| 9 | + ->in(__DIR__ . '/src') |
| 10 | +; |
| 11 | + |
| 12 | +return PhpCsFixer\Config::create() |
| 13 | + ->setRiskyAllowed(true) |
| 14 | + ->setRules([ |
| 15 | + '@PSR2' => true, |
| 16 | + 'array_syntax' => [ |
| 17 | + 'syntax' => 'short', |
| 18 | + ], |
| 19 | + 'binary_operator_spaces' => [ |
| 20 | + 'align_double_arrow' => false, |
| 21 | + 'align_equals' => false, |
| 22 | + ], |
| 23 | + 'blank_line_after_opening_tag' => true, |
| 24 | + 'cast_spaces' => true, |
| 25 | + 'concat_space' => [ |
| 26 | + 'spacing' => 'one', |
| 27 | + ], |
| 28 | + 'dir_constant' => true, |
| 29 | + 'ereg_to_preg' => true, |
| 30 | + 'function_typehint_space' => true, |
| 31 | + 'hash_to_slash_comment' => true, |
| 32 | + 'include' => true, |
| 33 | + 'heredoc_to_nowdoc' => true, |
| 34 | + 'is_null' => [ |
| 35 | + 'use_yoda_style' => false, |
| 36 | + ], |
| 37 | + 'linebreak_after_opening_tag' => true, |
| 38 | + 'lowercase_cast' => true, |
| 39 | + 'magic_constant_casing' => true, |
| 40 | + 'modernize_types_casting' => true, |
| 41 | + 'native_function_casing' => true, |
| 42 | + 'new_with_braces' => true, |
| 43 | + 'no_alias_functions' => true, |
| 44 | + 'no_blank_lines_after_class_opening' => true, |
| 45 | + 'no_blank_lines_after_phpdoc' => true, |
| 46 | + 'no_empty_comment' => true, |
| 47 | + 'no_empty_phpdoc' => true, |
| 48 | + 'no_empty_statement' => true, |
| 49 | + 'no_extra_consecutive_blank_lines' => [ |
| 50 | + 'tokens' => [ |
| 51 | + 'break', |
| 52 | + 'continue', |
| 53 | + 'return', |
| 54 | + 'throw', |
| 55 | + 'use', |
| 56 | + 'use_trait', |
| 57 | + 'parenthesis_brace_block', |
| 58 | + 'square_brace_block', |
| 59 | + ], |
| 60 | + ], |
| 61 | + 'no_leading_import_slash' => true, |
| 62 | + 'no_leading_namespace_whitespace' => true, |
| 63 | + 'no_mixed_echo_print' => true, |
| 64 | + 'no_multiline_whitespace_around_double_arrow' => true, |
| 65 | + 'no_multiline_whitespace_before_semicolons' => true, |
| 66 | + 'no_php4_constructor' => true, |
| 67 | + 'no_short_bool_cast' => true, |
| 68 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 69 | + 'no_spaces_around_offset' => true, |
| 70 | + 'no_trailing_comma_in_list_call' => true, |
| 71 | + 'no_trailing_comma_in_singleline_array' => true, |
| 72 | + 'no_unneeded_control_parentheses' => true, |
| 73 | + 'no_unused_imports' => true, |
| 74 | + 'no_useless_else' => true, |
| 75 | + 'no_useless_return' => true, |
| 76 | + 'no_whitespace_before_comma_in_array' => true, |
| 77 | + 'no_whitespace_in_blank_line' => true, |
| 78 | + 'non_printable_character' => true, |
| 79 | + 'normalize_index_brace' => true, |
| 80 | + 'object_operator_without_whitespace' => true, |
| 81 | + 'ordered_imports' => [ |
| 82 | + 'sortAlgorithm' => 'alpha', |
| 83 | + 'importsOrder' => [ |
| 84 | + 'const', |
| 85 | + 'function', |
| 86 | + 'class', |
| 87 | + ], |
| 88 | + ], |
| 89 | + 'php_unit_construct' => true, |
| 90 | + 'php_unit_dedicate_assert' => true, |
| 91 | + 'php_unit_fqcn_annotation' => true, |
| 92 | + 'phpdoc_add_missing_param_annotation' => true, |
| 93 | + 'phpdoc_indent' => true, |
| 94 | + 'phpdoc_no_access' => true, |
| 95 | + 'phpdoc_no_empty_return' => true, |
| 96 | + 'phpdoc_no_package' => true, |
| 97 | + 'phpdoc_no_useless_inheritdoc' => true, |
| 98 | + 'phpdoc_return_self_reference' => true, |
| 99 | + 'phpdoc_scalar' => true, |
| 100 | + 'phpdoc_single_line_var_spacing' => true, |
| 101 | + 'phpdoc_summary' => true, |
| 102 | + 'phpdoc_trim' => true, |
| 103 | + 'phpdoc_types' => true, |
| 104 | + 'phpdoc_var_without_name' => false, |
| 105 | + 'protected_to_private' => true, |
| 106 | + 'psr4' => true, |
| 107 | + 'self_accessor' => true, |
| 108 | + 'short_scalar_cast' => true, |
| 109 | + 'single_blank_line_before_namespace' => true, |
| 110 | + 'single_quote' => true, |
| 111 | + 'standardize_not_equals' => true, |
| 112 | + 'ternary_operator_spaces' => true, |
| 113 | + 'trailing_comma_in_multiline_array' => true, |
| 114 | + 'trim_array_spaces' => true, |
| 115 | + 'unary_operator_spaces' => true, |
| 116 | + 'whitespace_after_comma_in_array' => true, |
| 117 | + 'header_comment' => [ |
| 118 | + 'header' => $header, |
| 119 | + 'commentType' => 'PHPDoc', |
| 120 | + 'separate' => 'bottom', |
| 121 | + ], |
| 122 | + ]) |
| 123 | + ->setFinder($finder) |
| 124 | +; |
0 commit comments