Skip to content

Commit

Permalink
Generic.PHP.LowerCaseKeyword: require lowercase anonymous class keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
maryo committed Aug 17, 2024
1 parent 6fbbc10 commit 5759956
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Standards/Generic/Sniffs/PHP/LowerCaseKeywordSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function register()
{
$targets = Tokens::$contextSensitiveKeywords;
$targets += [
T_ANON_CLASS => T_ANON_CLASS,
T_CLOSURE => T_CLOSURE,
T_EMPTY => T_EMPTY,
T_ENUM_CASE => T_ENUM_CASE,
Expand Down
4 changes: 4 additions & 0 deletions src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@ EnuM ENUM: string
Case HEARTS;
}

new Class {};
new clasS extends stdClass {};
new class {};

__HALT_COMPILER(); // An exception due to phar support.
function
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@ enum ENUM: string
case HEARTS;
}

new class {};
new class extends stdClass {};
new class {};

__HALT_COMPILER(); // An exception due to phar support.
function
2 changes: 2 additions & 0 deletions src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public function getErrorList()
39 => 2,
42 => 1,
44 => 1,
47 => 1,
48 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit 5759956

Please sign in to comment.