From 748ba0f25d241006c9a92b46e3faccd45fc3b8ea Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Fri, 29 Nov 2024 08:53:48 +0100 Subject: [PATCH] Update doc and standards --- docs/rules.md | 6 ++++++ src/Standard/Twig.php | 2 ++ tests/Standard/TwigCsFixerTest.php | 2 ++ tests/Standard/TwigTest.php | 2 ++ 4 files changed, 12 insertions(+) diff --git a/docs/rules.md b/docs/rules.md index 3c17573e..fcab3d9e 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -100,6 +100,11 @@ To use these rules, you have to [allow non-fixable rules](configuration.md#non-f - `ignoredSubDirectories`: specific sub-directories to ignore. - `optionalPrefix`: allow to prefix file name by this prefix. +- **NamedArgumentNameRule**: + + Ensures named arguments uses snake_case. Options are: + - `case`: preferred case to use (default snake_case). + - **VariableNameRule** (Configurable): Ensures that variable name uses snake_case. Options are: @@ -154,6 +159,7 @@ new TwigCsFixer\Rules\Whitespace\IndentRule(3); **Twig**: - DelimiterSpacingRule +- NamedArgumentNameRule - NamedArgumentSpacingRule - OperatorNameSpacingRule - OperatorSpacingRule diff --git a/src/Standard/Twig.php b/src/Standard/Twig.php index 0b0ae703..8b02f700 100644 --- a/src/Standard/Twig.php +++ b/src/Standard/Twig.php @@ -5,6 +5,7 @@ namespace TwigCsFixer\Standard; use TwigCsFixer\Rules\Delimiter\DelimiterSpacingRule; +use TwigCsFixer\Rules\Function\NamedArgumentNameRule; use TwigCsFixer\Rules\Function\NamedArgumentSpacingRule; use TwigCsFixer\Rules\Operator\OperatorNameSpacingRule; use TwigCsFixer\Rules\Operator\OperatorSpacingRule; @@ -22,6 +23,7 @@ public function getRules(): array { return [ new DelimiterSpacingRule(), + new NamedArgumentNameRule(), new NamedArgumentSpacingRule(), new OperatorNameSpacingRule(), new OperatorSpacingRule(), diff --git a/tests/Standard/TwigCsFixerTest.php b/tests/Standard/TwigCsFixerTest.php index a8fd34e5..0b53cf21 100644 --- a/tests/Standard/TwigCsFixerTest.php +++ b/tests/Standard/TwigCsFixerTest.php @@ -8,6 +8,7 @@ use TwigCsFixer\Rules\Delimiter\BlockNameSpacingRule; use TwigCsFixer\Rules\Delimiter\DelimiterSpacingRule; use TwigCsFixer\Rules\Function\IncludeFunctionRule; +use TwigCsFixer\Rules\Function\NamedArgumentNameRule; use TwigCsFixer\Rules\Function\NamedArgumentSpacingRule; use TwigCsFixer\Rules\Operator\OperatorNameSpacingRule; use TwigCsFixer\Rules\Operator\OperatorSpacingRule; @@ -31,6 +32,7 @@ public function testGetRules(): void static::assertEquals([ new DelimiterSpacingRule(), + new NamedArgumentNameRule(), new NamedArgumentSpacingRule(), new OperatorNameSpacingRule(), new OperatorSpacingRule(), diff --git a/tests/Standard/TwigTest.php b/tests/Standard/TwigTest.php index f604f1ec..9d039d46 100644 --- a/tests/Standard/TwigTest.php +++ b/tests/Standard/TwigTest.php @@ -6,6 +6,7 @@ use PHPUnit\Framework\TestCase; use TwigCsFixer\Rules\Delimiter\DelimiterSpacingRule; +use TwigCsFixer\Rules\Function\NamedArgumentNameRule; use TwigCsFixer\Rules\Function\NamedArgumentSpacingRule; use TwigCsFixer\Rules\Operator\OperatorNameSpacingRule; use TwigCsFixer\Rules\Operator\OperatorSpacingRule; @@ -21,6 +22,7 @@ public function testGetRules(): void static::assertEquals([ new DelimiterSpacingRule(), + new NamedArgumentNameRule(), new NamedArgumentSpacingRule(), new OperatorNameSpacingRule(), new OperatorSpacingRule(),