From e55726a999f28e83f15bcd42bda8f024f97e6907 Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Sat, 6 Jul 2024 21:14:07 +0300 Subject: [PATCH] Check if class exists --- src/Debug/Provider/DebugApiProvider.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Debug/Provider/DebugApiProvider.php b/src/Debug/Provider/DebugApiProvider.php index 7de2b6a..232b230 100644 --- a/src/Debug/Provider/DebugApiProvider.php +++ b/src/Debug/Provider/DebugApiProvider.php @@ -23,7 +23,7 @@ public function getDefinitions(): array public function getExtensions(): array { - return [ + $extensions = [ RouteCollectorInterface::class => static function ( ContainerInterface $container, RouteCollectorInterface $routeCollector @@ -36,12 +36,18 @@ public function getExtensions(): array return $routeCollector; }, - Application::class => static function (ContainerInterface $container, Application $application) { + ]; + if (class_exists(Application::class)) { + $extensions[Application::class] = static function ( + ContainerInterface $container, + Application $application + ) { $applicationWrapper = $container->get(HttpApplicationWrapper::class); $applicationWrapper->wrap($application); return $application; - }, - ]; + }; + } + return $extensions; } }