Skip to content

Commit b16af79

Browse files
committed
Regression test
Closes phpstan/phpstan#7434
1 parent 4c1a2b9 commit b16af79

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

tests/PHPStan/Rules/Methods/CallMethodsRuleNamedArgumentRenamedParameterTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,14 @@ public function testRule(): void
5757
]);
5858
}
5959

60+
public function testBug7434(): void
61+
{
62+
$this->analyse([__DIR__ . '/data/bug-7434.php'], [
63+
[
64+
'Call to Bug7434\Contract::method() uses named argument for parameter $val, but Bug7434\ImplementationWithDifferentName renames it to $wrong.',
65+
28,
66+
],
67+
]);
68+
}
69+
6070
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug7434;
4+
5+
interface Contract
6+
{
7+
public function method(string $val): void;
8+
}
9+
10+
class Implementation implements Contract
11+
{
12+
public function method(string $val): void
13+
{
14+
15+
}
16+
}
17+
18+
class ImplementationWithDifferentName implements Contract
19+
{
20+
public function method(string $wrong): void
21+
{
22+
23+
}
24+
}
25+
26+
function takesContract(Contract $contract): void
27+
{
28+
$contract->method(val: 'string');
29+
}

0 commit comments

Comments
 (0)