Skip to content

Commit

Permalink
Update GroupedEndpointsFromApp.php
Browse files Browse the repository at this point in the history
Small bug fix for if the class doesnt exist then it will return false else it will cause the error
  • Loading branch information
zfhassaan authored Aug 28, 2023
1 parent 8407835 commit 33aa3a6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/GroupedEndpoints/GroupedEndpointsFromApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 33aa3a6

Please sign in to comment.