Use getReflectionMethod instead of getReflactionClassAndMethod

This commit is contained in:
Maxime Helias 2019-11-19 10:28:11 +01:00
parent bea1faec94
commit aa1432f35c
2 changed files with 1 additions and 19 deletions

@ -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);

@ -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])) {