Skip to content

Commit

Permalink
Merge pull request #6 from cego/niza/align-multiple-parameters
Browse files Browse the repository at this point in the history
Added rule for alignment of multiline parameters
  • Loading branch information
nizacegodk authored Jan 9, 2024
2 parents 4caec92 + 7ba36a4 commit ef24d63
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
],
"require": {
"php": "^7.0|^8.0",
"friendsofphp/php-cs-fixer": "^3.5"
"friendsofphp/php-cs-fixer": "^3.5",
"erickskrauch/php-cs-fixer-custom-fixers": "^1.2"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 3 additions & 1 deletion src/CegoFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Traversable;
use PhpCsFixer\Finder;
use PhpCsFixer\Config;
use ErickSkrauch\PhpCsFixer\Fixers;
use PhpCsFixer\Fixer\FixerInterface;

class CegoFixer
Expand All @@ -27,6 +28,7 @@ public static function applyRules(Finder $finder, array $customRules = [], bool
->setHideProgress(false)
->setUsingCache(true)
->registerCustomFixers($customFixers)
->registerCustomFixers(new Fixers())
->setRules(array_merge(CegoRuleSet::get(), $customRules));
}
}
}
17 changes: 9 additions & 8 deletions src/CegoRuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ public static function get(): array
'single_quote' => true,
'ternary_to_null_coalescing' => true,

'return_type_declaration' => ['space_before' => 'none'],
'array_syntax' => ['syntax' => 'short'],
'no_extra_blank_lines' => ['tokens' => ['extra']],
'concat_space' => ['spacing' => 'one'],
'ordered_imports' => ['sort_algorithm' => 'length'],
'binary_operator_spaces' => ['operators' => ['=>' => 'align_single_space_minimal']],
'class_attributes_separation' => ['elements' => ['method' => 'one']],
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try', 'for', 'foreach', 'if', 'switch', 'do', 'while']],
'return_type_declaration' => ['space_before' => 'none'],
'array_syntax' => ['syntax' => 'short'],
'no_extra_blank_lines' => ['tokens' => ['extra']],
'concat_space' => ['spacing' => 'one'],
'ordered_imports' => ['sort_algorithm' => 'length'],
'binary_operator_spaces' => ['operators' => ['=>' => 'align_single_space_minimal']],
'class_attributes_separation' => ['elements' => ['method' => 'one']],
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try', 'for', 'foreach', 'if', 'switch', 'do', 'while']],
'ErickSkrauch/align_multiline_parameters' => ['variables' => true],

'method_argument_space' => [
'keep_multiple_spaces_after_comma' => false,
Expand Down

0 comments on commit ef24d63

Please sign in to comment.