Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5fcfec2

Browse files
author
plumthedev
committed
Update PHP CS Fixer Config to merge new rules, add project header!
1 parent c1f9fd2 commit 5fcfec2

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

‎src/Config.php‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
<?php
22
/**
3-
* Yii2 PHP CS Fixer Config - Config.
3+
* Yii2 PHP CS Fixer Config
44
*
55
* @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
710
*/
811

912
namespace plumthedev\PhpCsFixer;
1013

1114
use PhpCsFixer\Config as PhpCsFixerConfig;
15+
use yii\helpers\ArrayHelper;
1216

1317
class Config extends PhpCsFixerConfig
1418
{
@@ -17,11 +21,7 @@ public function __construct($name = 'yii2-php-cs-fixer-config')
1721
parent::__construct($name);
1822
$this->setRiskyAllowed(true);
1923
$this->setFinder(Finder::create());
20-
}
21-
22-
public function getRules()
23-
{
24-
return [
24+
$this->setRules([
2525
'@PSR2' => true,
2626
'array_syntax' => [
2727
'syntax' => 'short',
@@ -124,6 +124,13 @@ public function getRules()
124124
'trim_array_spaces' => true,
125125
'unary_operator_spaces' => true,
126126
'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;
128135
}
129136
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /