Skip to content

Commit

Permalink
Merge pull request #31 from nextcloud/enh/break-promoted-properties-o…
Browse files Browse the repository at this point in the history
…n-multiline

feat: Add rule for having one promoted property per line in constructor
  • Loading branch information
ChristophWurst authored Sep 18, 2024
2 parents bc9c53a + fe1d17f commit 233bb15
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog
All notable changes to this project will be documented in this file.

## 1.2.4 - TBA

### Changed
* `trailing_comma_in_multiline`: Add a trailing comma to multline function parameters
* `MultilinePromotedPropertiesFixer`: Break promoted properties on multiple lines

## 1.2.3 - 2024-08-23
### Changed
* `cast_spaces`: No space between cast and variable
Expand Down
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
4 changes: 4 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
namespace Nextcloud\CodingStandard;

use PhpCsFixer\Config as Base;
use PhpCsFixerCustomFixers;

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 @@ -67,11 +69,13 @@ public function getRules() : array {
'single_line_after_imports' => true,
'single_quote' => ['strings_containing_single_quote_chars' => false],
'switch_case_space' => true,
'trailing_comma_in_multiline' => ['elements' => ['parameters']],
'types_spaces' => ['space' => 'none', 'space_multiple_catch' => 'none'],
'visibility_required' => [
'elements' => ['property', 'method', 'const']
],
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer::name() => true,
];
}
}

0 comments on commit 233bb15

Please sign in to comment.