Skip to content

Commit

Permalink
feat: Add rule for having one promoted property per line in constructor
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed Sep 18, 2024
1 parent bc9c53a commit caae821
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"type": "library",
"require": {
"php": "^7.3|^8.0",
"php-cs-fixer/shim": "^3.17"
"php-cs-fixer/shim": "^3.17",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.22"
},
"license": "MIT",
"authors": [
Expand Down
2 changes: 2 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Config extends Base {
public function __construct($name = 'default') {
parent::__construct($name);
$this->setIndent("\t");
$this->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers());
}

public function getRules() : array {
Expand Down Expand Up @@ -72,6 +73,7 @@ public function getRules() : array {
'elements' => ['property', 'method', 'const']
],
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer::name() => true,
];
}
}

0 comments on commit caae821

Please sign in to comment.