mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +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');
|
$controller = $route->getDefault('_controller');
|
||||||
if ($callable = $this->controllerReflector->getReflectionClassAndMethod($controller)) {
|
if ($method = $this->controllerReflector->getReflectionMethod($controller)) {
|
||||||
list($class, $method) = $callable;
|
|
||||||
$path = $this->normalizePath($route->getPath());
|
$path = $this->normalizePath($route->getPath());
|
||||||
$httpMethods = $route->getMethods() ?: Swagger::$METHODS;
|
$httpMethods = $route->getMethods() ?: Swagger::$METHODS;
|
||||||
$httpMethods = array_map('strtolower', $httpMethods);
|
$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)
|
private function getClassAndMethod(string $controller)
|
||||||
{
|
{
|
||||||
if (isset($this->controllers[$controller])) {
|
if (isset($this->controllers[$controller])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user