Skip to content

Commit

Permalink
#101 - lowercase keywords (#104)
Browse files Browse the repository at this point in the history
* #101 - lowercase keywords

* #101 - fix
  • Loading branch information
Baakoma authored Sep 25, 2023
1 parent 5c34484 commit 5059c63
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Configuration/Defaults/CommonRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -328,5 +329,6 @@ class CommonRules extends Rules
CurlyBracesPositionFixer::class => [
"anonymous_functions_opening_brace" => "same_line",
],
LowercaseKeywordsFixer::class => true,
];
}
1 change: 1 addition & 0 deletions tests/codestyle/CommonRulesetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public static function providePhp80Fixtures(): array
["blankLineBeforeStatement"],
["braces"],
["stringVariables"],
["lowercaseKeywords"],
];
}

Expand Down
22 changes: 22 additions & 0 deletions tests/fixtures/lowercaseKeywords/actual.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

Class LowercaseKeywordsTest Extends ObjectOperatorTest
{
PUBLIC function test(): int
{
Foreach (range(1, 5) as $item) {
IF ($item > 3) {
Return 0;
}
}

RETURN 5;
}

public function testAnonymousClass(): void
{
new Class() EXTENDS LowercaseKeywordsTest {};
}
}
22 changes: 22 additions & 0 deletions tests/fixtures/lowercaseKeywords/expected.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

class LowercaseKeywordsTest extends ObjectOperatorTest
{
public function test(): int
{
foreach (range(1, 5) as $item) {
if ($item > 3) {
return 0;
}
}

return 5;
}

public function testAnonymousClass(): void
{
new class() extends LowercaseKeywordsTest {};
}
}

0 comments on commit 5059c63

Please sign in to comment.