Skip to content

Commit 4576346

Browse files
committed
Fix
1 parent 1236c17 commit 4576346

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,22 @@ public function dataOverridingFinalMethod(): array
3030
[
3131
70300,
3232
'compatible',
33+
'compatible',
3334
],
3435
[
3536
70400,
3637
'contravariant',
38+
'covariant',
3739
],
3840
];
3941
}
4042

4143
/**
4244
* @dataProvider dataOverridingFinalMethod
4345
* @param int $phpVersion
44-
* @param string $message
46+
* @param string $contravariantMessage
4547
*/
46-
public function testOverridingFinalMethod(int $phpVersion, string $message): void
48+
public function testOverridingFinalMethod(int $phpVersion, string $contravariantMessage): void
4749
{
4850
if (!self::$useStaticReflectionProvider) {
4951
$this->markTestSkipped('Test requires static reflection.');
@@ -76,15 +78,15 @@ public function testOverridingFinalMethod(int $phpVersion, string $message): voi
7678
68,
7779
],
7880
[
79-
'Parameter #1 $s (string) of method OverridingFinalMethod\Dolor::__construct() is not ' . $message . ' with parameter #1 $i (int) of method OverridingFinalMethod\Ipsum::__construct().',
81+
'Parameter #1 $s (string) of method OverridingFinalMethod\Dolor::__construct() is not ' . $contravariantMessage . ' with parameter #1 $i (int) of method OverridingFinalMethod\Ipsum::__construct().',
8082
110,
8183
],
8284
[
8385
'Method OverridingFinalMethod\Dolor::doFoo() overrides method OverridingFinalMethod\Ipsum::doFoo() but misses parameter #1 $i.',
8486
115,
8587
],
8688
[
87-
'Parameter #1 $size (int) of method OverridingFinalMethod\FixedArray::setSize() is not ' . $message . ' with parameter #1 $size (mixed) of method SplFixedArray::setSize().',
89+
'Parameter #1 $size (int) of method OverridingFinalMethod\FixedArray::setSize() is not ' . $contravariantMessage . ' with parameter #1 $size (mixed) of method SplFixedArray::setSize().',
8890
125,
8991
],
9092
[
@@ -282,20 +284,26 @@ public function testReturnTypeCovariance(
282284
$this->analyse([__DIR__ . '/data/return-type-covariance.php'], $expectedErrors);
283285
}
284286

285-
public function testParle(): void
287+
/**
288+
* @dataProvider dataOverridingFinalMethod
289+
* @param int $phpVersion
290+
* @param string $contravariantMessage
291+
* @param string $covariantMessage
292+
*/
293+
public function testParle(int $phpVersion, string $contravariantMessage, string $covariantMessage): void
286294
{
287295
if (!self::$useStaticReflectionProvider) {
288296
$this->markTestSkipped('Test requires static reflection.');
289297
}
290298

291-
$this->phpVersionId = PHP_VERSION_ID;
299+
$this->phpVersionId = $phpVersion;
292300
$this->analyse([__DIR__ . '/data/parle.php'], [
293301
[
294-
'Parameter #1 $state (int) of method OverridingParle\Foo::pushState() is not contravariant with parameter #1 $state (string) of method Parle\RLexer::pushState().',
302+
'Parameter #1 $state (int) of method OverridingParle\Foo::pushState() is not ' . $contravariantMessage . ' with parameter #1 $state (string) of method Parle\RLexer::pushState().',
295303
8,
296304
],
297305
[
298-
'Return type string of method OverridingParle\Foo::pushState() is not covariant with return type int of method Parle\RLexer::pushState().',
306+
'Return type string of method OverridingParle\Foo::pushState() is not ' . $covariantMessage . ' with return type int of method Parle\RLexer::pushState().',
299307
8,
300308
],
301309
]);

0 commit comments

Comments
 (0)