Skip to content

Commit

Permalink
Merge pull request #1556 from maxhelias/reflection-method
Browse files Browse the repository at this point in the history
Use getReflectionMethod instead of getReflactionClassAndMethod
  • Loading branch information
GuilhemN authored Nov 21, 2019
2 parents e9cdde1 + aa1432f commit f596adf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
3 changes: 1 addition & 2 deletions Describer/SwaggerPhpDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ private function getMethodsToParse(): \Generator
}

$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);
Expand Down
17 changes: 0 additions & 17 deletions Util/ControllerReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,6 @@ public function getReflectionMethod(string $controller)
}
}

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])) {
Expand Down

0 comments on commit f596adf

Please sign in to comment.