Skip to content

Commit 179299c

Browse files
Merge pull request #50 from nextcloud/logical-operators-2
fix: Define risky by default and only use the rule then
2 parents fc33aa9 + 7969285 commit 179299c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Config.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
use PhpCsFixerCustomFixers;
99

1010
class Config extends Base {
11-
public function __construct($name = 'default') {
11+
public function __construct($name = 'default', bool $allowRisky = true) {
1212
parent::__construct($name);
1313
$this->setIndent("\t");
1414
$this->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers());
15+
$this->setRiskyAllowed($allowRisky);
1516
}
1617

1718
public function getRules() : array {
18-
return [
19+
$rules = [
1920
'@PSR1' => true,
2021
'@PSR2' => true,
2122
'align_multiline_comment' => true,
@@ -41,7 +42,6 @@ public function getRules() : array {
4142
'indentation_type' => true,
4243
'line_ending' => true,
4344
'list_syntax' => true,
44-
'logical_operators' => true,
4545
'lowercase_cast' => true,
4646
'lowercase_keywords' => true,
4747
'method_argument_space' => [
@@ -85,5 +85,11 @@ public function getRules() : array {
8585
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
8686
PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer::name() => true,
8787
];
88+
89+
if ($this->getRiskyAllowed()) {
90+
$rules['logical_operators'] = true;
91+
}
92+
93+
return $rules;
8894
}
8995
}

0 commit comments

Comments
 (0)