Skip to content

Commit

Permalink
Parameter with a default value followed by a variadic parameter is al…
Browse files Browse the repository at this point in the history
…so optional
  • Loading branch information
ondrejmirtes committed Jun 8, 2020
1 parent 7aabe35 commit 3af7eaf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"nette/utils": "^3.1.1",
"nikic/php-parser": "^4.5.0",
"ondram/ci-detector": "^3.1",
"ondrejmirtes/better-reflection": "^4.3.4",
"ondrejmirtes/better-reflection": "^4.3.5",
"phpdocumentor/type-resolver": "1.0.1",
"phpstan/phpdoc-parser": "^0.4.7",
"react/child-process": "^0.6.1",
Expand Down
8 changes: 8 additions & 0 deletions tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1354,4 +1354,12 @@ public function testExplicitMixed(): void
]);
}

public function testBug3409(): void
{
$this->checkThisOnly = false;
$this->checkNullables = true;
$this->checkUnionTypes = true;
$this->analyse([__DIR__ . '/data/bug-3409.php'], []);
}

}
18 changes: 18 additions & 0 deletions tests/PHPStan/Rules/Methods/data/bug-3409.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Bug3409;

class Foo
{

public function doFoo()
{
$this->doBar();
}

public function doBar(?callable $callback = null, ...$args): void
{

}

}

0 comments on commit 3af7eaf

Please sign in to comment.