File tree 1 file changed +15
-8
lines changed 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
/**
3
- * Yii2 PHP CS Fixer Config - Config.
3
+ * Yii2 PHP CS Fixer Config
4
4
*
5
5
* @author Kacper Pruszynski (plumthedev)
6
- * @version 1.0.0
6
+ * @link https://github.com/plumthedev/yii2-php-cs-fixer-config
7
+ * @copyright Copyright (c) 2019 plumthedev
8
+ * @license https://github.com/plumthedev/yii2-php-cs-fixer-config/blob/master/LICENSE
9
+ * @version 1.0.1
7
10
*/
8
11
9
12
namespace plumthedev \PhpCsFixer ;
10
13
11
14
use PhpCsFixer \Config as PhpCsFixerConfig ;
15
+ use yii \helpers \ArrayHelper ;
12
16
13
17
class Config extends PhpCsFixerConfig
14
18
{
@@ -17,11 +21,7 @@ public function __construct($name = 'yii2-php-cs-fixer-config')
17
21
parent ::__construct ($ name );
18
22
$ this ->setRiskyAllowed (true );
19
23
$ this ->setFinder (Finder::create ());
20
- }
21
-
22
- public function getRules ()
23
- {
24
- return [
24
+ $ this ->setRules ([
25
25
'@PSR2 ' => true ,
26
26
'array_syntax ' => [
27
27
'syntax ' => 'short ' ,
@@ -124,6 +124,13 @@ public function getRules()
124
124
'trim_array_spaces ' => true ,
125
125
'unary_operator_spaces ' => true ,
126
126
'whitespace_after_comma_in_array ' => true ,
127
- ];
127
+ ]);
128
+ }
129
+
130
+ public function mergeRules ($ rules )
131
+ {
132
+ $ mergedRules = ArrayHelper::merge ($ this ->getRules (), $ rules );
133
+ $ this ->setRules ($ mergedRules );
134
+ return $ this ;
128
135
}
129
136
}
You can’t perform that action at this time.
0 commit comments