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 44
55use PHPStan \Rules \Rule ;
66use PHPStan \Testing \RuleTestCase ;
7+ use const PHP_VERSION_ID ;
78
89/** @extends RuleTestCase<FinalPrivateMethodRule> */
910class 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 ,
You can’t perform that action at this time.
0 commit comments