From aa1432f35c030a60fb40ee62ca1eb1cfe0d00da8 Mon Sep 17 00:00:00 2001 From: Maxime Helias Date: Tue, 19 Nov 2019 10:28:11 +0100 Subject: [PATCH] Use getReflectionMethod instead of getReflactionClassAndMethod --- Describer/SwaggerPhpDescriber.php | 3 +-- Util/ControllerReflector.php | 17 ----------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/Describer/SwaggerPhpDescriber.php b/Describer/SwaggerPhpDescriber.php index 956bc53..d9f64a5 100644 --- a/Describer/SwaggerPhpDescriber.php +++ b/Describer/SwaggerPhpDescriber.php @@ -229,8 +229,7 @@ final class SwaggerPhpDescriber implements ModelRegistryAwareInterface } $controller = $route->getDefault('_controller'); - if ($callable = $this->controllerReflector->getReflectionClassAndMethod($controller)) { - list($class, $method) = $callable; + if ($method = $this->controllerReflector->getReflectionMethod($controller)) { $path = $this->normalizePath($route->getPath()); $httpMethods = $route->getMethods() ?: Swagger::$METHODS; $httpMethods = array_map('strtolower', $httpMethods); diff --git a/Util/ControllerReflector.php b/Util/ControllerReflector.php index 7eba46e..df10f9c 100644 --- a/Util/ControllerReflector.php +++ b/Util/ControllerReflector.php @@ -56,23 +56,6 @@ class ControllerReflector } } - public function getReflectionClassAndMethod(string $controller) - { - $callable = $this->getClassAndMethod($controller); - if (null === $callable) { - return; - } - - list($class, $method) = $callable; - - try { - return [new \ReflectionClass($class), new \ReflectionMethod($class, $method)]; - } catch (\ReflectionException $e) { - // In case we can't reflect the controller, we just - // ignore the route - } - } - private function getClassAndMethod(string $controller) { if (isset($this->controllers[$controller])) {