From 188f147c7dc0126c91a2de57933171a61dec30af Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Fri, 14 Aug 2026 02:55:57 -0400 Subject: [PATCH] invert Dispatcher@setContainerHandler conditional and remove $containerFQCN --- flight/core/Dispatcher.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/flight/core/Dispatcher.php b/flight/core/Dispatcher.php index 6d427a0..22f59bf 100644 --- a/flight/core/Dispatcher.php +++ b/flight/core/Dispatcher.php @@ -50,17 +50,13 @@ class Dispatcher */ public function setContainerHandler($containerHandler): void { - $containerFQCN = '\\' . Container::class; + if (!$containerHandler instanceof Container && !is_callable($containerHandler)) { + $message = "\$containerHandler must be of type callable or instance \\" . Container::class; - if (is_a($containerHandler, $containerFQCN) || is_callable($containerHandler)) { - $this->containerHandler = $containerHandler; - - return; + throw new InvalidArgumentException($message); } - $message = "\$containerHandler must be of type callable or instance $containerFQCN"; - - throw new InvalidArgumentException($message); + $this->containerHandler = $containerHandler; } public function setEngine(Engine $engine): void