From abb6d364e5afcc6951d9af0ee8394b85da013b33 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Wed, 18 Sep 2024 13:02:54 +0200 Subject: [PATCH] feat: Add blank lines before returns and after control statements Signed-off-by: provokateurin --- CHANGELOG.md | 4 +++- composer.json | 3 ++- src/Config.php | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e02c3fd..454d89b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,13 @@ # Changelog All notable changes to this project will be documented in this file. -## 1.2.4 - TBA +## 1.3.0 - TBA ### Changed * `trailing_comma_in_multiline`: Add a trailing comma to multline function parameters * `MultilinePromotedPropertiesFixer`: Break promoted properties on multiple lines +* `ErickSkrauch/blank_line_before_return`: Add a blank line before each return +* `ErickSkrauch/line_break_after_statements`: Add a blank line after all control statements ## 1.2.3 - 2024-08-23 ### Changed diff --git a/composer.json b/composer.json index f0e2091..f8ac7ca 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,8 @@ "require": { "php": "^7.3|^8.0", "php-cs-fixer/shim": "^3.17", - "kubawerlos/php-cs-fixer-custom-fixers": "^3.22" + "kubawerlos/php-cs-fixer-custom-fixers": "^3.22", + "erickskrauch/php-cs-fixer-custom-fixers": "^1.3" }, "license": "MIT", "authors": [ diff --git a/src/Config.php b/src/Config.php index f4db60b..6895b89 100644 --- a/src/Config.php +++ b/src/Config.php @@ -12,6 +12,7 @@ public function __construct($name = 'default') { parent::__construct($name); $this->setIndent("\t"); $this->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers()); + $this->registerCustomFixers(new \ErickSkrauch\PhpCsFixer\Fixers()); } public function getRules() : array { @@ -76,6 +77,8 @@ public function getRules() : array { ], 'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer::name() => true, + 'ErickSkrauch/blank_line_before_return' => true, + 'ErickSkrauch/line_break_after_statements' => true, ]; } }