Skip to content

Commit 4c1eb36

Browse files
committed
PHP 8.4 | Generic/UnnecessaryFinalModifier: add tests with final properties
1 parent 9388922 commit 4c1eb36

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
@@ -54,3 +54,25 @@ class Regular_Class_Regular_Constants {
5454
protected const PROTECTED_CONST = 'foo';
5555
private const PRIVATE_CONST = true;
5656
}
57+
58+
final class Final_Class_Final_Properties {
59+
final readonly public ?MyType $final_public;
60+
protected final $final_protected = 'foo';
61+
}
62+
63+
final class Final_Class_Regular_Properties {
64+
public $public = 23;
65+
protected string $protected = 'foo';
66+
private $private = true;
67+
}
68+
69+
class Regular_Class_Final_Properties {
70+
public static final $final_public = 23;
71+
final readonly $final_protected = 'foo';
72+
}
73+
74+
class Regular_Class_Regular_Properties {
75+
public $public = 23;
76+
protected $protected = 'foo';
77+
private static bool $private = true;
78+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public function getWarningList($testFile='')
5858
33 => 1,
5959
37 => 1,
6060
38 => 1,
61+
59 => 1,
62+
60 => 1,
6163
];
6264
default:
6365
return [];

0 commit comments

Comments
 (0)