diff --git a/Routing/Loader/Reader/RestActionReader.php b/Routing/Loader/Reader/RestActionReader.php index 21185a81f..6d4068301 100644 --- a/Routing/Loader/Reader/RestActionReader.php +++ b/Routing/Loader/Reader/RestActionReader.php @@ -302,13 +302,14 @@ private function getHttpMethodAndResourcesFromMethod(\ReflectionMethod $method, ) { $isCollection = true; $httpMethod = substr($httpMethod, 1); - if (!empty($resource)) { - $resourcePluralized = $this->inflector->pluralize(end($resource)); - $isInflectable = ($resourcePluralized != $resource[count($resource) - 1]); - $resource[count($resource)-1] = $resourcePluralized; - } - } elseif ('options' === $httpMethod && !empty($resource) && 's' === substr($method->getName(), -1)) { - $resource[count($resource)-1] = $this->inflector->pluralize(end($resource)); + } elseif ('options' === $httpMethod) { + $isCollection = true; + } + + if ($isCollection && !empty($resource)) { + $resourcePluralized = $this->inflector->pluralize(end($resource)); + $isInflectable = ($resourcePluralized != $resource[count($resource) - 1]); + $resource[count($resource)-1] = $resourcePluralized; } $resources = array_merge($resource, $resources); diff --git a/Tests/Fixtures/Controller/ArticleController.php b/Tests/Fixtures/Controller/ArticleController.php index eaf08335a..25ba3e97d 100644 --- a/Tests/Fixtures/Controller/ArticleController.php +++ b/Tests/Fixtures/Controller/ArticleController.php @@ -17,7 +17,7 @@ class ArticleController extends FosRestController implements ClassResourceInterface { - public function optionsActions() + public function optionsAction() {} // [OPTIONS] /articles public function cgetAction()