Skip to content

Commit

Permalink
Widen $args type to iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevay committed Oct 10, 2022
1 parent 78e10eb commit 8c4e666
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/API/Trace/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* @template R
* @param SpanInterface $span span to enclose the closure with
* @param Closure(...): R $closure closure to invoke
* @param array $args arguments to provide to the closure
* @param iterable<int|string, mixed> $args arguments to provide to the closure
* @return R result of the closure invocation
*
* @phpstan-ignore-next-line
*/
function trace(SpanInterface $span, Closure $closure, array $args = [])
function trace(SpanInterface $span, Closure $closure, iterable $args = [])
{
$s = $span;
$c = $closure;
Expand All @@ -31,6 +31,7 @@ function trace(SpanInterface $span, Closure $closure, array $args = [])
$scope = $s->activate();

try {
/** @psalm-suppress InvalidArgument */
return $c(...$a, ...($a = []));
} catch (Throwable $e) {
$s->setStatus(StatusCode::STATUS_ERROR, $e->getMessage());
Expand Down

0 comments on commit 8c4e666

Please sign in to comment.