Skip to content

Commit d1c0413

Browse files
committed
Generic/UnnecessaryFinalModifier: add tests for final class constants
1 parent 93c83e3 commit d1c0413

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.1.inc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,25 @@ final readonly class Foo_Bar {
3232
public final function fooBar() {}
3333
final protected function fool() {}
3434
}
35+
36+
final class Final_Class_Final_Constants {
37+
final public const FINAL_PUBLIC_CONST = 23;
38+
protected final const FINAL_PROTECTED_CONST = 'foo';
39+
}
40+
41+
final class Final_Class_Regular_Constants {
42+
public const PUBLIC_CONST = 23;
43+
protected const PROTECTED_CONST = 'foo';
44+
private const PRIVATE_CONST = true;
45+
}
46+
47+
class Regular_Class_Final_Constants {
48+
public final const FINAL_PUBLIC_CONST = 23;
49+
final protected const FINAL_PROTECTED_CONST = 'foo';
50+
}
51+
52+
class Regular_Class_Regular_Constants {
53+
public const PUBLIC_CONST = 23;
54+
protected const PROTECTED_CONST = 'foo';
55+
private const PRIVATE_CONST = true;
56+
}

src/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public function getWarningList($testFile='')
5656
18 => 1,
5757
32 => 1,
5858
33 => 1,
59+
37 => 1,
60+
38 => 1,
5961
];
6062
default:
6163
return [];

0 commit comments

Comments
 (0)