From caae8218e13f617551b34cbc16b43dcab1cc8f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 18 Sep 2024 12:24:16 +0200 Subject: [PATCH] feat: Add rule for having one promoted property per line in constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- composer.json | 3 ++- src/Config.php | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7e825f1..f0e2091 100644 --- a/composer.json +++ b/composer.json @@ -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": [ diff --git a/src/Config.php b/src/Config.php index 73b9baf..b41ba3a 100644 --- a/src/Config.php +++ b/src/Config.php @@ -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 { @@ -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, ]; } }