Skip to content

Commit 6d572ae

Browse files
committed
Add fixer to place promoted properties on a new line when there is more than 1 parameter
1 parent 050dfe6 commit 6d572ae

File tree

5 files changed

+63
-4
lines changed

5 files changed

+63
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
### Added
99
- Enh #12: Implemented `Ely\align_multiline_parameters` fixer.
1010
- Enabled `Ely\align_multiline_parameters` for Ely.by codestyle in `['types' => false, 'defaults' => false]` mode.
11+
- Enabled
12+
[`PhpCsFixerCustomFixers/multiline_promoted_properties`](https://github.com/kubawerlos/php-cs-fixer-custom-fixers#multilinepromotedpropertiesfixer)
13+
fixer for Ely.by codestyle in 2+ parameters mode.
1114

1215
### Fixed
1316
- Bug #10: `Ely/blank_line_before_return` don't treat interpolation curly bracket as beginning of the scope.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"homepage": "https://github.com/elyby/php-code-style",
2121
"require": {
2222
"php": "^7.4 || ^8.0",
23-
"friendsofphp/php-cs-fixer": "^3.13"
23+
"friendsofphp/php-cs-fixer": "^3.13",
24+
"kubawerlos/php-cs-fixer-custom-fixers": "^3.13"
2425
},
2526
"require-dev": {
2627
"ergebnis/composer-normalize": "^2.28",

composer.lock

Lines changed: 47 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Config.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33

44
namespace Ely\CS;
55

6+
use Ely\CS\Fixers as ElyFixers;
67
use PhpCsFixer\Config as PhpCsFixerConfig;
8+
use PhpCsFixer\ConfigInterface as PhpCsFixerConfigInterface;
9+
use PhpCsFixerCustomFixers\Fixers as KubawerlosFixers;
710

811
class Config {
912

10-
public static function create(array $overwrittenRules = []): PhpCsFixerConfig {
13+
public static function create(array $overwrittenRules = []): PhpCsFixerConfigInterface {
1114
return (new PhpCsFixerConfig())
1215
->setRiskyAllowed(true)
13-
->registerCustomFixers(new Fixers())
16+
->registerCustomFixers(new ElyFixers())
17+
->registerCustomFixers(new KubawerlosFixers())
1418
->setRules(Rules::create($overwrittenRules));
1519
}
1620

src/Rules.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ public static function create(array $overwrittenRules = []): array {
213213
'space_multiple_catch' => 'none',
214214
],
215215

216+
// kubawerlos fixers
217+
'PhpCsFixerCustomFixers/multiline_promoted_properties' => [
218+
'minimum_number_of_parameters' => 2,
219+
],
220+
216221
// Our custom or extended fixers
217222
'Ely/align_multiline_parameters' => [
218223
'variables' => false,

0 commit comments

Comments
 (0)