mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Merge pull request #1556 from maxhelias/reflection-method
Use getReflectionMethod instead of getReflactionClassAndMethod
This commit is contained in:
commit
f596adfb4d
@ -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);
|
||||
|
@ -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])) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user