File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
tests/PHPStan/Rules/Methods Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use PHPStan \Rules \Rule ;
6
6
use PHPStan \Testing \RuleTestCase ;
7
+ use const PHP_VERSION_ID ;
7
8
8
9
/** @extends RuleTestCase<FinalPrivateMethodRule> */
9
10
class FinalPrivateMethodRuleTest extends RuleTestCase
@@ -16,11 +17,16 @@ protected function getRule(): Rule
16
17
17
18
public function testRule (): void
18
19
{
19
- $ this ->analyse ([__DIR__ . '/data/final-private-method.php ' ], [
20
- [
20
+ $ error = [];
21
+ if (PHP_VERSION_ID >= 80000 ) {
22
+ $ error = [
21
23
'Private method FinalPrivateMethod\Foo::foo() cannot be final as it is never overridden by other classes. ' ,
22
24
8 ,
23
- ],
25
+ ];
26
+ }
27
+
28
+ $ this ->analyse ([__DIR__ . '/data/final-private-method.php ' ], [
29
+ $ error ,
24
30
[
25
31
'Private method FinalPrivateMethod\FooBarPhp8orHigher::foo() cannot be final as it is never overridden by other classes. ' ,
26
32
39 ,
You can’t perform that action at this time.
0 commit comments