Skip to content

Commit 313d9db

Browse files
committed
PHP 8.1: Squiz/ClassFileName - Added support for enums
1 parent b2b38ed commit 313d9db

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

src/Standards/Squiz/Sniffs/Classes/ClassFileNameSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function register()
2727
T_CLASS,
2828
T_INTERFACE,
2929
T_TRAIT,
30+
T_ENUM,
3031
];
3132

3233
}//end register()

src/Standards/Squiz/Tests/Classes/ClassFileNameUnitTest.inc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
class ClassFileNameUnitTest {}
66
interface ClassFileNameUnitTest {}
77
trait ClassFileNameUnitTest {}
8+
enum ClassFileNameUnitTest {}
89

910

1011
// Invalid filename matching class name (case sensitive).
@@ -17,6 +18,9 @@ interface CLASSFILENAMEUNITTEST {}
1718
trait classFileNameUnitTest {}
1819
trait classfilenameunittest {}
1920
trait CLASSFILENAMEUNITTEST {}
21+
enum classFileNameUnitTest {}
22+
enum classfilenameunittest {}
23+
enum CLASSFILENAMEUNITTEST {}
2024

2125

2226
// Invalid non-filename matching class names.
@@ -32,6 +36,10 @@ trait CompletelyWrongClassName {}
3236
trait ClassFileNameUnitTestExtra {}
3337
trait ClassFileNameUnitTestInc {}
3438
trait ExtraClassFileNameUnitTest {}
39+
enum CompletelyWrongClassName {}
40+
enum ClassFileNameUnitTestExtra {}
41+
enum ClassFileNameUnitTestInc {}
42+
enum ExtraClassFileNameUnitTest {}
3543

3644

37-
?>
45+
?>

src/Standards/Squiz/Tests/Classes/ClassFileNameUnitTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class ClassFileNameUnitTest extends AbstractSniffUnitTest
2626
public function getErrorList()
2727
{
2828
return [
29-
11 => 1,
3029
12 => 1,
3130
13 => 1,
3231
14 => 1,
@@ -35,10 +34,10 @@ public function getErrorList()
3534
17 => 1,
3635
18 => 1,
3736
19 => 1,
37+
20 => 1,
38+
21 => 1,
39+
22 => 1,
3840
23 => 1,
39-
24 => 1,
40-
25 => 1,
41-
26 => 1,
4241
27 => 1,
4342
28 => 1,
4443
29 => 1,
@@ -47,6 +46,14 @@ public function getErrorList()
4746
32 => 1,
4847
33 => 1,
4948
34 => 1,
49+
35 => 1,
50+
36 => 1,
51+
37 => 1,
52+
38 => 1,
53+
39 => 1,
54+
40 => 1,
55+
41 => 1,
56+
42 => 1,
5057
];
5158

5259
}//end getErrorList()

0 commit comments

Comments
 (0)