Merge pull request #1556 from maxhelias/reflection-method

Use getReflectionMethod instead of getReflactionClassAndMethod
This commit is contained in:
Guilhem Niot 2019-11-21 18:18:16 +01:00 committed by GitHub
commit f596adfb4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 19 deletions

View File

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

View File

@ -59,23 +59,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])) {