From 8b791a0d4f69911824019390047ed38d694635b8 Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Wed, 4 Oct 2023 16:01:06 +0200 Subject: [PATCH] PER - The `fn` keyword MUST NOT be succeeded by a space. --- doc/ruleSets/PER-CS2.0.rst | 4 ++++ .../function_notation/function_declaration.rst | 15 ++++++++++++--- src/RuleSet/Sets/PERCS2x0Set.php | 5 +++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/ruleSets/PER-CS2.0.rst b/doc/ruleSets/PER-CS2.0.rst index 5fa939feb1f..d521aa0279c 100644 --- a/doc/ruleSets/PER-CS2.0.rst +++ b/doc/ruleSets/PER-CS2.0.rst @@ -12,5 +12,9 @@ Rules ``['spacing' => 'one']`` +- `function_declaration <./../rules/function_notation/function_declaration.rst>`_ with config: + + ``['closure_fn_spacing' => 'none', 'closure_function_spacing' => 'one', 'trailing_comma_single_line' => false]`` + - `method_argument_space <./../rules/function_notation/method_argument_space.rst>`_ - `single_line_empty_body <./../rules/basic/single_line_empty_body.rst>`_ diff --git a/doc/rules/function_notation/function_declaration.rst b/doc/rules/function_notation/function_declaration.rst index 31ab93dad30..a6e9f861ab3 100644 --- a/doc/rules/function_notation/function_declaration.rst +++ b/doc/rules/function_notation/function_declaration.rst @@ -94,10 +94,19 @@ Rule sets The rule is part of the following rule sets: -- `@PER <./../../ruleSets/PER.rst>`_ -- `@PER-CS <./../../ruleSets/PER-CS.rst>`_ +- `@PER <./../../ruleSets/PER.rst>`_ with config: + + ``['closure_fn_spacing' => 'none', 'closure_function_spacing' => 'one', 'trailing_comma_single_line' => false]`` + +- `@PER-CS <./../../ruleSets/PER-CS.rst>`_ with config: + + ``['closure_fn_spacing' => 'none', 'closure_function_spacing' => 'one', 'trailing_comma_single_line' => false]`` + - `@PER-CS1.0 <./../../ruleSets/PER-CS1.0.rst>`_ -- `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_ +- `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_ with config: + + ``['closure_fn_spacing' => 'none', 'closure_function_spacing' => 'one', 'trailing_comma_single_line' => false]`` + - `@PSR2 <./../../ruleSets/PSR2.rst>`_ - `@PSR12 <./../../ruleSets/PSR12.rst>`_ - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ diff --git a/src/RuleSet/Sets/PERCS2x0Set.php b/src/RuleSet/Sets/PERCS2x0Set.php index 419b1a38850..3b1ac3df482 100644 --- a/src/RuleSet/Sets/PERCS2x0Set.php +++ b/src/RuleSet/Sets/PERCS2x0Set.php @@ -35,6 +35,11 @@ public function getRules(): array return [ '@PER-CS1.0' => true, 'concat_space' => ['spacing' => 'one'], + 'function_declaration' => [ + 'closure_fn_spacing' => 'none', + 'closure_function_spacing' => 'one', + 'trailing_comma_single_line' => false, + ], 'method_argument_space' => true, 'single_line_empty_body' => true, ];