Skip to content

Commit 2e41ff9

Browse files
Add missing parameter type (#84)
Co-authored-by: Rafa Gómez <[email protected]>
1 parent a5e02f2 commit 2e41ff9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/apply.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@
1010
* This function tries to solve the problem of calling a function stored in a class attribute, because if you try
1111
* `$this->callable($arg1, $arg2)` PHP expects `$this->callable` to be a function and not a property. And to avoid
1212
* use the magic method _invoke_ that will properly work `$this->callable->__invoke($arg1, $arg2)` we use go with
13-
* `apply($this->callable, $arg1, $arg2)`.
13+
* `apply($this->callable, [$arg1, $arg2])`.
1414
*
1515
* Be aware that using this function most IDEs will lose the path, so they will not detect that your are passing the
1616
* wrong number of parameters or will not do as you expect a change of signature. To have a good test suite would be a
1717
* requirement for a widely use of this function in your code.
1818
*
1919
* @param callable $fn function to be executed
20-
* @param mixed[] $args arguments to be passed to the called function
20+
* @param iterable $args arguments to be passed to the called function
2121
*
2222
* @return mixed
2323
*
2424
* @since 0.1
2525
*/
26-
function apply(callable $fn, $args = [])
26+
function apply(callable $fn, iterable $args = [])
2727
{
2828
return $fn(...to_array($args));
2929
}

0 commit comments

Comments
 (0)