From 8618c3af8a475461fb9cebf6671d1f08beaaec72 Mon Sep 17 00:00:00 2001 From: Nicolo Singer Date: Wed, 15 Jul 2026 12:52:36 +0200 Subject: [PATCH] Add `Throwable` to `CommandBus::dispatch` @throws Handlers can throw any exception, and without declaring it, catching one forces `@phpstan-ignore catch.neverThrown` everywhere, which is a bad pattern. Signed-off-by: Nicolo Singer --- src/CommandBus/CommandBus.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CommandBus/CommandBus.php b/src/CommandBus/CommandBus.php index f47ee9c28..c4c3323d5 100644 --- a/src/CommandBus/CommandBus.php +++ b/src/CommandBus/CommandBus.php @@ -4,8 +4,13 @@ namespace Patchlevel\EventSourcing\CommandBus; +use Throwable; + interface CommandBus { - /** @throws HandlerNotFound */ + /** + * @throws HandlerNotFound + * @throws Throwable + */ public function dispatch(object $command): void; }