|
4 | 4 | *
|
5 | 5 | * @author Kacper Pruszynski (plumthedev)
|
6 | 6 | * @link https://github.com/plumthedev/yii2-php-cs-fixer-config
|
7 |
| - * @copyright Copyright (c) 2019 plumthedev |
| 7 | + * @copyright Copyright (c) 2019 - 2019 plumthedev |
8 | 8 | * @license https://github.com/plumthedev/yii2-php-cs-fixer-config/blob/master/LICENSE
|
9 | 9 | * @version 1.0.1
|
10 | 10 | */
|
11 | 11 |
|
12 | 12 | namespace plumthedev\PhpCsFixer;
|
13 | 13 |
|
14 |
| -use PhpCsFixer\Config as PhpCsFixerConfig; |
15 |
| -use yii\helpers\ArrayHelper; |
| 14 | +use yii\cs\YiiConfig as YiiCsFixerConfig; |
16 | 15 |
|
17 |
| -class Config extends PhpCsFixerConfig |
| 16 | +class Config extends YiiCsFixerConfig |
18 | 17 | {
|
19 | 18 | public function __construct($name = 'yii2-php-cs-fixer-config')
|
20 | 19 | {
|
21 | 20 | parent::__construct($name);
|
22 |
| - $this->setRiskyAllowed(true); |
23 | 21 | $this->setFinder(Finder::create());
|
24 |
| - $this->setRules([ |
25 |
| - '@PSR2' => true, |
26 |
| - 'array_syntax' => [ |
27 |
| - 'syntax' => 'short', |
28 |
| - ], |
29 |
| - 'binary_operator_spaces' => [ |
30 |
| - 'align_double_arrow' => false, |
31 |
| - 'align_equals' => false, |
32 |
| - ], |
33 |
| - 'blank_line_after_opening_tag' => true, |
34 |
| - 'cast_spaces' => true, |
35 |
| - 'concat_space' => [ |
36 |
| - 'spacing' => 'one', |
37 |
| - ], |
38 |
| - 'dir_constant' => true, |
39 |
| - 'ereg_to_preg' => true, |
40 |
| - 'function_typehint_space' => true, |
41 |
| - 'hash_to_slash_comment' => true, |
42 |
| - 'include' => true, |
43 |
| - 'heredoc_to_nowdoc' => true, |
44 |
| - 'is_null' => [ |
45 |
| - 'use_yoda_style' => false, |
46 |
| - ], |
47 |
| - 'linebreak_after_opening_tag' => true, |
48 |
| - 'lowercase_cast' => true, |
49 |
| - 'magic_constant_casing' => true, |
50 |
| - 'modernize_types_casting' => true, |
51 |
| - 'native_function_casing' => true, |
52 |
| - 'new_with_braces' => true, |
53 |
| - 'no_alias_functions' => true, |
54 |
| - 'no_blank_lines_after_class_opening' => true, |
55 |
| - 'no_blank_lines_after_phpdoc' => true, |
56 |
| - 'no_empty_comment' => true, |
57 |
| - 'no_empty_phpdoc' => true, |
58 |
| - 'no_empty_statement' => true, |
59 |
| - 'no_extra_consecutive_blank_lines' => [ |
60 |
| - 'tokens' => [ |
61 |
| - 'break', |
62 |
| - 'continue', |
63 |
| - 'return', |
64 |
| - 'throw', |
65 |
| - 'use', |
66 |
| - 'use_trait', |
67 |
| - 'parenthesis_brace_block', |
68 |
| - 'square_brace_block', |
69 |
| - ], |
70 |
| - ], |
71 |
| - 'no_leading_import_slash' => true, |
72 |
| - 'no_leading_namespace_whitespace' => true, |
73 |
| - 'no_mixed_echo_print' => true, |
74 |
| - 'no_multiline_whitespace_around_double_arrow' => true, |
75 |
| - 'no_multiline_whitespace_before_semicolons' => true, |
76 |
| - 'no_php4_constructor' => true, |
77 |
| - 'no_short_bool_cast' => true, |
78 |
| - 'no_singleline_whitespace_before_semicolons' => true, |
79 |
| - 'no_spaces_around_offset' => true, |
80 |
| - 'no_trailing_comma_in_list_call' => true, |
81 |
| - 'no_trailing_comma_in_singleline_array' => true, |
82 |
| - 'no_unneeded_control_parentheses' => true, |
83 |
| - 'no_unused_imports' => true, |
84 |
| - 'no_useless_else' => true, |
85 |
| - 'no_useless_return' => true, |
86 |
| - 'no_whitespace_before_comma_in_array' => true, |
87 |
| - 'no_whitespace_in_blank_line' => true, |
88 |
| - 'non_printable_character' => true, |
89 |
| - 'normalize_index_brace' => true, |
90 |
| - 'object_operator_without_whitespace' => true, |
91 |
| - 'ordered_imports' => [ |
92 |
| - 'sortAlgorithm' => 'alpha', |
93 |
| - 'importsOrder' => [ |
94 |
| - 'const', |
95 |
| - 'function', |
96 |
| - 'class', |
97 |
| - ], |
98 |
| - ], |
99 |
| - 'php_unit_construct' => true, |
100 |
| - 'php_unit_dedicate_assert' => true, |
101 |
| - 'php_unit_fqcn_annotation' => true, |
102 |
| - 'phpdoc_add_missing_param_annotation' => true, |
103 |
| - 'phpdoc_indent' => true, |
104 |
| - 'phpdoc_no_access' => true, |
105 |
| - 'phpdoc_no_empty_return' => true, |
106 |
| - 'phpdoc_no_package' => true, |
107 |
| - 'phpdoc_no_useless_inheritdoc' => true, |
108 |
| - 'phpdoc_return_self_reference' => true, |
109 |
| - 'phpdoc_scalar' => true, |
110 |
| - 'phpdoc_single_line_var_spacing' => true, |
111 |
| - 'phpdoc_summary' => true, |
112 |
| - 'phpdoc_trim' => true, |
113 |
| - 'phpdoc_types' => true, |
114 |
| - 'phpdoc_var_without_name' => true, |
115 |
| - 'protected_to_private' => true, |
116 |
| - 'psr4' => true, |
117 |
| - 'self_accessor' => true, |
118 |
| - 'short_scalar_cast' => true, |
119 |
| - 'single_blank_line_before_namespace' => true, |
120 |
| - 'single_quote' => true, |
121 |
| - 'standardize_not_equals' => true, |
122 |
| - 'ternary_operator_spaces' => true, |
123 |
| - 'trailing_comma_in_multiline_array' => true, |
124 |
| - 'trim_array_spaces' => true, |
125 |
| - 'unary_operator_spaces' => true, |
126 |
| - 'whitespace_after_comma_in_array' => true, |
127 |
| - ]); |
128 |
| - } |
129 |
| - |
130 |
| - public function mergeRules($rules) |
131 |
| - { |
132 |
| - $mergedRules = ArrayHelper::merge($this->getRules(), $rules); |
133 |
| - $this->setRules($mergedRules); |
134 |
| - return $this; |
135 | 22 | }
|
136 | 23 | }
|
0 commit comments