Callback
throws a TypeError
when checking a callable
has variadic parameters
#5946
Labels
feature/assertion
Issues related to assertions and expectations
type/bug
Something is broken
version/10
Something affects PHPUnit 10
version/11
Something affects PHPUnit 11
Summary
I think recent changes to the
Callback
class to handle variadic parameters are causing this type error:Current behavior
The
Callback
class accepts acallable
but it passes that toReflectionFunction
, which only accepts aClosure
.How to reproduce
You can reproduce it by directly calling the
Callback
class with a callable and then calling theisVariadic
method:Expected behavior
The callable should be converted to a closure before being passed to
ReflectionFunction
.I do have a branch open that fixes the issue. If it looks acceptable I can open a PR for it: https://github.com/sebastianbergmann/phpunit/compare/main...ziadoz:phpunit:fix-callback-callable-variadic?expand=1
The text was updated successfully, but these errors were encountered: