Skip to content

Commit 70fb8fc

Browse files
authored
Merge branch refs/heads/1.10.x into 1.11.x
2 parents 93beecf + 074de75 commit 70fb8fc

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/Rules/UnusedFunctionParametersCheck.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function getUsedVariables(Scope $scope, $node): array
6262
if ($node instanceof Node) {
6363
if ($node instanceof Node\Expr\FuncCall && $node->name instanceof Node\Name) {
6464
$functionName = $this->reflectionProvider->resolveFunctionName($node->name, $scope);
65-
if ($functionName === 'func_get_args') {
65+
if ($functionName === 'func_get_args' || $functionName === 'get_defined_vars') {
6666
return $scope->getDefinedVariables();
6767
}
6868
}

tests/PHPStan/Rules/Classes/UnusedConstructorParametersRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,9 @@ public function testBug1917(): void
4343
$this->analyse([__DIR__ . '/data/bug-1917.php'], []);
4444
}
4545

46+
public function testBug10865(): void
47+
{
48+
$this->analyse([__DIR__ . '/data/bug-10865.php'], []);
49+
}
50+
4651
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Bug10865;
4+
5+
class TestParent {
6+
7+
/** @param array<string|int, mixed> $args */
8+
public function __construct(array $args) {
9+
10+
var_dump($args);
11+
}
12+
}
13+
14+
class Test extends TestParent {
15+
16+
public function __construct(int $a) {
17+
18+
parent::__construct(get_defined_vars());
19+
//parent::__construct(func_get_args());
20+
}
21+
}

0 commit comments

Comments
 (0)