Skip to content

Commit 5023c5c

Browse files
committed
Generic.PHP.LowerCaseKeyword: require lowercase anonymous class keyword
1 parent 6fbbc10 commit 5023c5c

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

src/Standards/Generic/Sniffs/PHP/LowerCaseKeywordSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function register()
3636
T_PARENT => T_PARENT,
3737
T_SELF => T_SELF,
3838
T_UNSET => T_UNSET,
39+
T_ANON_CLASS => T_ANON_CLASS,
3940
];
4041

4142
return $targets;

src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,8 @@ EnuM ENUM: string
4444
Case HEARTS;
4545
}
4646

47+
new Class {};
48+
new clasS extends stdClass {};
49+
4750
__HALT_COMPILER(); // An exception due to phar support.
4851
function

src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc.fixed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,8 @@ enum ENUM: string
4444
case HEARTS;
4545
}
4646

47+
new class {};
48+
new class extends stdClass {};
49+
4750
__HALT_COMPILER(); // An exception due to phar support.
4851
function

src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public function getErrorList()
4848
39 => 2,
4949
42 => 1,
5050
44 => 1,
51+
47 => 1,
52+
48 => 1,
5153
];
5254

5355
}//end getErrorList()

0 commit comments

Comments
 (0)