From f8bdffd90c098d2395bf4f52a53fb70f9e4642a8 Mon Sep 17 00:00:00 2001 From: PedroTroller Date: Mon, 25 Sep 2023 12:05:07 +0200 Subject: [PATCH] fix: conflict bettween method_argument_space and line_break_between_method_arguments --- .../CodingStyle/LineBreakBetweenMethodArgumentsFixer.php | 6 +++++- tests/Orchestra.php | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/PedroTroller/CS/Fixer/CodingStyle/LineBreakBetweenMethodArgumentsFixer.php b/src/PedroTroller/CS/Fixer/CodingStyle/LineBreakBetweenMethodArgumentsFixer.php index 3c7115a..6b94a32 100644 --- a/src/PedroTroller/CS/Fixer/CodingStyle/LineBreakBetweenMethodArgumentsFixer.php +++ b/src/PedroTroller/CS/Fixer/CodingStyle/LineBreakBetweenMethodArgumentsFixer.php @@ -8,6 +8,7 @@ use PedroTroller\CS\Fixer\Priority; use PhpCsFixer\Fixer\Basic\BracesFixer; use PhpCsFixer\Fixer\ConfigurableFixerInterface; +use PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer; use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface; use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver; use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface; @@ -22,7 +23,10 @@ final class LineBreakBetweenMethodArgumentsFixer extends AbstractFixer implement public function getPriority(): int { - return Priority::after(BracesFixer::class); + return min( + Priority::after(BracesFixer::class), + Priority::after(MethodArgumentSpaceFixer::class), + ); } public function getSampleConfigurations(): array diff --git a/tests/Orchestra.php b/tests/Orchestra.php index 0501f4a..a92f807 100644 --- a/tests/Orchestra.php +++ b/tests/Orchestra.php @@ -5,10 +5,13 @@ namespace tests; use PedroTroller\CS\Fixer\ClassNotation\OrderedWithGetterAndSetterFirstFixer; +use PedroTroller\CS\Fixer\CodingStyle\LineBreakBetweenMethodArgumentsFixer; use PedroTroller\CS\Fixer\DoctrineMigrationsFixer; +use PhpCsFixer\Fixer\Basic\BracesFixer; use PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer; use PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer; use PhpCsFixer\Fixer\FixerInterface; +use PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer; use PhpCsFixer\Fixer\Import\SingleLineAfterImportsFixer; use PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer; use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer; @@ -41,6 +44,11 @@ public static function run(): void ->before(new NoWhitespaceInBlankLineFixer()) ; + self::assert(new LineBreakBetweenMethodArgumentsFixer()) + ->after(new BracesFixer()) + ->after(new MethodArgumentSpaceFixer()) + ; + echo "\n"; }