mirror of
https://github.com/danog/amp.git
synced 2024-12-03 09:57:51 +01:00
throw is now an expression!
This commit is contained in:
parent
b95048abd9
commit
8865458454
@ -58,10 +58,8 @@ final class Placeholder
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->result = null;
|
$this->result = null;
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $exception) {
|
||||||
Loop::defer(static function () use ($e): void {
|
Loop::defer(static fn() => throw $exception);
|
||||||
throw $e;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,9 +71,7 @@ final class ResolutionQueue
|
|||||||
Promise\rethrow($result);
|
Promise\rethrow($result);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
Loop::defer(static function () use ($exception): void {
|
Loop::defer(static fn() => throw $exception);
|
||||||
throw $exception;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,9 @@ class DeferTest extends AsyncTestCase
|
|||||||
|
|
||||||
$exception = new TestException;
|
$exception = new TestException;
|
||||||
|
|
||||||
defer(function () use ($exception): void {
|
defer(fn() => throw $exception);
|
||||||
throw $exception;
|
|
||||||
});
|
|
||||||
|
|
||||||
delay(1); // Tick event loop.
|
delay(5); // Tick event loop.
|
||||||
|
|
||||||
$this->assertSame($exception, $reason);
|
$this->assertSame($exception, $reason);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user