Skip to content

Commit 5467db0

Browse files
Add test
1 parent 62f8200 commit 5467db0

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3673,7 +3673,12 @@ public function testBug12219(): void
36733673
$this->checkNullables = true;
36743674
$this->checkUnionTypes = true;
36753675
$this->checkExplicitMixed = true;
3676-
$this->analyse([__DIR__ . '/data/bug-12219.php'], []);
3676+
$this->analyse([__DIR__ . '/data/bug-12219.php'], [
3677+
[
3678+
'Parameter #2 $value of method Bug12219\Bug3::foo() contains unresolvable type.',
3679+
75,
3680+
],
3681+
]);
36773682
}
36783683

36793684
public function testBug13511(): void

tests/PHPStan/Rules/Methods/data/bug-12219.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,26 @@ public function bar(string $class, mixed $value): void
5252
$this->foo($class, $value);
5353
}
5454
}
55+
56+
class Bug3
57+
{
58+
/**
59+
* @template T of \UnitEnum
60+
* @param class-string<T> $class
61+
* @param value-of<T> $value
62+
*/
63+
public function foo(string $class, mixed $value): void
64+
{
65+
}
66+
67+
/**
68+
* @template Q of \UnitEnum
69+
* @param class-string<Q> $class
70+
* @param value-of<Q> $value
71+
*/
72+
public function bar(string $class, mixed $value): void
73+
{
74+
// Parameter #2 $value of static method Bug::foo() contains unresolvable type.
75+
$this->foo($class, $value);
76+
}
77+
}

0 commit comments

Comments
 (0)