Open
Description
Reproduce:
use React\EventLoop\Factory as Loop;
use React\Async;
use React\Promise\Deferred;
$loop = Loop::create();
$deferred = new Deferred;
$promise = $deferred->promise();
$loop->addTimer(0.02, function() use($deferred) {
$deferred->resolve();
});
$foo = function() use($promise) {
Async\await($promise);
echo 'All good' . PHP_EOL;
};
$loop->addTimer(0.01, $foo);
$loop->run();
How to fix it is known: wrap $foo
into Async\async
. But the error sucks anyway. You guys gotta find a way to get it either work anyway, or throw a nice error telling us what is wrong and hinting what to do.