From 33aa3a6b100a883c7b166635409fbfa083e611a5 Mon Sep 17 00:00:00 2001 From: Hassaan Ali Date: Mon, 28 Aug 2023 06:30:21 +0500 Subject: [PATCH] Update GroupedEndpointsFromApp.php Small bug fix for if the class doesnt exist then it will return false else it will cause the error --- src/GroupedEndpoints/GroupedEndpointsFromApp.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/GroupedEndpoints/GroupedEndpointsFromApp.php b/src/GroupedEndpoints/GroupedEndpointsFromApp.php index 18209ffb..8e79d9fd 100644 --- a/src/GroupedEndpoints/GroupedEndpointsFromApp.php +++ b/src/GroupedEndpoints/GroupedEndpointsFromApp.php @@ -237,16 +237,18 @@ private function isValidRoute(?array $routeControllerAndMethod): bool private function doesControllerMethodExist(array $routeControllerAndMethod): bool { - if (count($routeControllerAndMethod) < 2) { + if (count($routeControllerAndMethod) < 2) { throw CouldntGetRouteDetails::new(); } [$class, $method] = $routeControllerAndMethod; - $reflection = new ReflectionClass($class); - if ($reflection->hasMethod($method)) { - return true; - } + if (class_exists($class)) { + $reflection = new ReflectionClass($class); + if ($reflection->hasMethod($method)) { + return true; + } + } return false; }