Skip to content

Commit 3af7eaf

Browse files
committed
Parameter with a default value followed by a variadic parameter is also optional
1 parent 7aabe35 commit 3af7eaf

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"nette/utils": "^3.1.1",
2222
"nikic/php-parser": "^4.5.0",
2323
"ondram/ci-detector": "^3.1",
24-
"ondrejmirtes/better-reflection": "^4.3.4",
24+
"ondrejmirtes/better-reflection": "^4.3.5",
2525
"phpdocumentor/type-resolver": "1.0.1",
2626
"phpstan/phpdoc-parser": "^0.4.7",
2727
"react/child-process": "^0.6.1",

tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,4 +1354,12 @@ public function testExplicitMixed(): void
13541354
]);
13551355
}
13561356

1357+
public function testBug3409(): void
1358+
{
1359+
$this->checkThisOnly = false;
1360+
$this->checkNullables = true;
1361+
$this->checkUnionTypes = true;
1362+
$this->analyse([__DIR__ . '/data/bug-3409.php'], []);
1363+
}
1364+
13571365
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Bug3409;
4+
5+
class Foo
6+
{
7+
8+
public function doFoo()
9+
{
10+
$this->doBar();
11+
}
12+
13+
public function doBar(?callable $callback = null, ...$args): void
14+
{
15+
16+
}
17+
18+
}

0 commit comments

Comments
 (0)