diff --git a/src/Configuration/Defaults/CommonRules.php b/src/Configuration/Defaults/CommonRules.php index 8ce9c01..21e9f49 100644 --- a/src/Configuration/Defaults/CommonRules.php +++ b/src/Configuration/Defaults/CommonRules.php @@ -14,6 +14,7 @@ use PhpCsFixer\Fixer\Basic\NoMultipleStatementsPerLineFixer; use PhpCsFixer\Fixer\Basic\NoTrailingCommaInSinglelineFixer; use PhpCsFixer\Fixer\Basic\PsrAutoloadingFixer; +use PhpCsFixer\Fixer\Casing\LowercaseKeywordsFixer; use PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer; use PhpCsFixer\Fixer\Casing\MagicConstantCasingFixer; use PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer; @@ -328,5 +329,6 @@ class CommonRules extends Rules CurlyBracesPositionFixer::class => [ "anonymous_functions_opening_brace" => "same_line", ], + LowercaseKeywordsFixer::class => true, ]; } diff --git a/tests/codestyle/CommonRulesetTest.php b/tests/codestyle/CommonRulesetTest.php index 2b97ea2..d7fc94d 100644 --- a/tests/codestyle/CommonRulesetTest.php +++ b/tests/codestyle/CommonRulesetTest.php @@ -62,6 +62,7 @@ public static function providePhp80Fixtures(): array ["blankLineBeforeStatement"], ["braces"], ["stringVariables"], + ["lowercaseKeywords"], ]; } diff --git a/tests/fixtures/lowercaseKeywords/actual.php b/tests/fixtures/lowercaseKeywords/actual.php new file mode 100644 index 0000000..98b445e --- /dev/null +++ b/tests/fixtures/lowercaseKeywords/actual.php @@ -0,0 +1,22 @@ + 3) { + Return 0; + } + } + + RETURN 5; + } + + public function testAnonymousClass(): void + { + new Class() EXTENDS LowercaseKeywordsTest {}; + } +} diff --git a/tests/fixtures/lowercaseKeywords/expected.php b/tests/fixtures/lowercaseKeywords/expected.php new file mode 100644 index 0000000..e74fa06 --- /dev/null +++ b/tests/fixtures/lowercaseKeywords/expected.php @@ -0,0 +1,22 @@ + 3) { + return 0; + } + } + + return 5; + } + + public function testAnonymousClass(): void + { + new class() extends LowercaseKeywordsTest {}; + } +}