Skip to content

Commit 17c3bed

Browse files
committed
fix test on php 7.4
1 parent c4bb074 commit 17c3bed

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/PHPStan/Rules/Methods/FinalPrivateMethodRuleTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use PHPStan\Rules\Rule;
66
use PHPStan\Testing\RuleTestCase;
7+
use const PHP_VERSION_ID;
78

89
/** @extends RuleTestCase<FinalPrivateMethodRule> */
910
class FinalPrivateMethodRuleTest extends RuleTestCase
@@ -16,11 +17,16 @@ protected function getRule(): Rule
1617

1718
public function testRule(): void
1819
{
19-
$this->analyse([__DIR__ . '/data/final-private-method.php'], [
20-
[
20+
$error = [];
21+
if (PHP_VERSION_ID >= 80000) {
22+
$error = [
2123
'Private method FinalPrivateMethod\Foo::foo() cannot be final as it is never overridden by other classes.',
2224
8,
23-
],
25+
];
26+
}
27+
28+
$this->analyse([__DIR__ . '/data/final-private-method.php'], [
29+
$error,
2430
[
2531
'Private method FinalPrivateMethod\FooBarPhp8orHigher::foo() cannot be final as it is never overridden by other classes.',
2632
39,

0 commit comments

Comments
 (0)