Skip to content

Commit 32c8f35

Browse files
author
plumthedev
committed
use yii2 cs fixer config
1 parent f8b48b4 commit 32c8f35

File tree

1 file changed

+3
-116
lines changed

1 file changed

+3
-116
lines changed

src/Config.php

Lines changed: 3 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -4,133 +4,20 @@
44
*
55
* @author Kacper Pruszynski (plumthedev)
66
* @link https://github.com/plumthedev/yii2-php-cs-fixer-config
7-
* @copyright Copyright (c) 2019 plumthedev
7+
* @copyright Copyright (c) 2019 - 2019 plumthedev
88
* @license https://github.com/plumthedev/yii2-php-cs-fixer-config/blob/master/LICENSE
99
* @version 1.0.1
1010
*/
1111

1212
namespace plumthedev\PhpCsFixer;
1313

14-
use PhpCsFixer\Config as PhpCsFixerConfig;
15-
use yii\helpers\ArrayHelper;
14+
use yii\cs\YiiConfig as YiiCsFixerConfig;
1615

17-
class Config extends PhpCsFixerConfig
16+
class Config extends YiiCsFixerConfig
1817
{
1918
public function __construct($name = 'yii2-php-cs-fixer-config')
2019
{
2120
parent::__construct($name);
22-
$this->setRiskyAllowed(true);
2321
$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;
13522
}
13623
}

0 commit comments

Comments
 (0)