File tree Expand file tree Collapse file tree 3 files changed +45
-9
lines changed
src/Standards/Generic/Tests/CodeAnalysis Expand file tree Collapse file tree 3 files changed +45
-9
lines changed Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ // Intentional parse error (class without body). Testing that the sniff is *not* triggered
4+ // in this case.
5+ final class Missing_Body
Original file line number Diff line number Diff line change @@ -41,18 +41,27 @@ public function getErrorList()
4141 * The key of the array should represent the line number and the value
4242 * should represent the number of warnings that should occur on that line.
4343 *
44+ * @param string $testFile The name of the test file being tested.
45+ *
4446 * @return array<int, int>
4547 */
46- public function getWarningList ()
48+ public function getWarningList ($ testFile = '' )
4749 {
48- return [
49- 11 => 1 ,
50- 12 => 1 ,
51- 15 => 1 ,
52- 18 => 1 ,
53- 32 => 1 ,
54- 33 => 1 ,
55- ];
50+ switch ($ testFile ) {
51+ case 'UnnecessaryFinalModifierUnitTest.1.inc ' :
52+ return [
53+ 11 => 1 ,
54+ 12 => 1 ,
55+ 15 => 1 ,
56+ 18 => 1 ,
57+ 32 => 1 ,
58+ 33 => 1 ,
59+ 37 => 1 ,
60+ 38 => 1 ,
61+ ];
62+ default :
63+ return [];
64+ }
5665
5766 }//end getWarningList()
5867
You can’t perform that action at this time.
0 commit comments