1
0
mirror of https://github.com/danog/amp.git synced 2024-12-02 17:37:50 +01:00

throw is now an expression!

This commit is contained in:
Aaron Piotrowski 2020-11-29 22:36:55 -06:00
parent b95048abd9
commit 8865458454
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB
3 changed files with 5 additions and 11 deletions

View File

@ -58,10 +58,8 @@ final class Placeholder
{
try {
$this->result = null;
} catch (\Throwable $e) {
Loop::defer(static function () use ($e): void {
throw $e;
});
} catch (\Throwable $exception) {
Loop::defer(static fn() => throw $exception);
}
}

View File

@ -71,9 +71,7 @@ final class ResolutionQueue
Promise\rethrow($result);
}
} catch (\Throwable $exception) {
Loop::defer(static function () use ($exception): void {
throw $exception;
});
Loop::defer(static fn() => throw $exception);
}
}
}

View File

@ -18,11 +18,9 @@ class DeferTest extends AsyncTestCase
$exception = new TestException;
defer(function () use ($exception): void {
throw $exception;
});
defer(fn() => throw $exception);
delay(1); // Tick event loop.
delay(5); // Tick event loop.
$this->assertSame($exception, $reason);
}