From 156a6d3904203778a1dd77ad145620a5f6802ad2 Mon Sep 17 00:00:00 2001 From: Julien Deniau Date: Tue, 27 Aug 2024 13:04:02 +0000 Subject: [PATCH] Prefer prettier over Symfony style --- src/Config.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Config.php b/src/Config.php index d69bff6..ec78d5c 100644 --- a/src/Config.php +++ b/src/Config.php @@ -93,7 +93,7 @@ public function getRules(): array // List (array destructuring) assignment should be declared using the configured syntax. // https://cs.symfony.com/doc/rules/list_notation/list_syntax.html 'list_syntax' => ['syntax' => 'short'], - + // Replace non multibyte-safe functions with corresponding mb function. // https://cs.symfony.com/doc/rules/alias/mb_str_functions.html 'mb_str_functions' => $this->useRisky, @@ -120,7 +120,26 @@ public function getRules(): array // 'allow_hidden_params' => true, // TODO activate this when available 'remove_inheritdoc' => true, 'allow_mixed' => true, - ], + ], + + // Operators - when multiline - must always be at the beginning or at the end of the line. + // Not explicitly set in PER, use the prettier version instead of Symfony's one + // https://cs.symfony.com/doc/rules/operator/operator_linebreak.html + 'operator_linebreak' => [ + 'only_booleans' => true, + 'position' => 'end', + ], + + // Ensures a single space after language constructs. + // Comparing to Symfony let prettier handle `as` like it wants + // https://cs.symfony.com/doc/rules/language_construct/single_space_around_construct.html + 'single_space_around_construct' => [ + 'constructs_preceded_by_a_single_space' => ['use_lambda'] + + ], + + // until prettier fixes https://github.com/prettier/plugin-php/issues/2400 + 'single_line_empty_body' => false, // === Doctrine === @@ -159,4 +178,3 @@ public function getRules(): array return $out; } } -