Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add rule for having one promoted property per line in constructor #31

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
];
}
}
Loading