1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00

Bind local vars to closure

This commit is contained in:
Daniel Lowrey 2015-03-25 14:17:26 -04:00
parent 654e82f277
commit 9a1581c91d

View File

@ -473,7 +473,7 @@ function wait(Promise $promise, Reactor $reactor = null) {
* Return a function that will be resolved as a coroutine once invoked
*/
function coroutine(callable $func, Reactor $reactor = null, callable $promisifier = null): callable {
return function(...$args) use ($func) {
return function(...$args) use ($func, $reactor, $promisifier) {
$result = $func(...$args);
return ($result instanceof \Generator)
? resolve($result, $reactor, $promisifier)