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:
parent
654e82f277
commit
9a1581c91d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user