mirror of
https://github.com/danog/amp.git
synced 2025-01-22 13:21:16 +01:00
Reduce nesting
This commit is contained in:
parent
a673c80fde
commit
0c031e7c90
@ -49,13 +49,15 @@ namespace Amp
|
||||
{
|
||||
$placeholder = new Internal\Placeholder;
|
||||
|
||||
Loop::defer(static fn() => \Fiber::create(static function () use ($placeholder, $callback, $args): void {
|
||||
$fiber = \Fiber::create(static function () use ($placeholder, $callback, $args): void {
|
||||
try {
|
||||
$placeholder->resolve($callback(...$args));
|
||||
} catch (\Throwable $exception) {
|
||||
$placeholder->fail($exception);
|
||||
}
|
||||
})->start());
|
||||
});
|
||||
|
||||
Loop::defer(static fn() => $fiber->start());
|
||||
|
||||
return new Internal\PrivatePromise($placeholder);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user