diff --git a/src/ChainRouteCollection.php b/src/ChainRouteCollection.php index 71f86d6d..4f0d25e0 100644 --- a/src/ChainRouteCollection.php +++ b/src/ChainRouteCollection.php @@ -241,6 +241,10 @@ public function setMethods($methods) */ public function getResources() { + if (0 === count($this->routeCollections)) { + return []; + } + $resources = array_map(function (RouteCollection $routeCollection) { return $routeCollection->getResources(); }, $this->routeCollections); diff --git a/src/ChainRouter.php b/src/ChainRouter.php index bd36ba6f..2edc8a42 100644 --- a/src/ChainRouter.php +++ b/src/ChainRouter.php @@ -124,12 +124,12 @@ public function all() */ protected function sortRouters() { - krsort($this->routers); - if (0 === count($this->routers)) { return []; } + krsort($this->routers); + return call_user_func_array('array_merge', $this->routers); } diff --git a/src/DynamicRouter.php b/src/DynamicRouter.php index dad2e5f7..89a4862f 100644 --- a/src/DynamicRouter.php +++ b/src/DynamicRouter.php @@ -348,12 +348,12 @@ public function getRouteEnhancers() */ protected function sortRouteEnhancers() { - krsort($this->enhancers); - if (0 === count($this->enhancers)) { return []; } + krsort($this->enhancers); + return call_user_func_array('array_merge', $this->enhancers); } diff --git a/src/NestedMatcher/NestedMatcher.php b/src/NestedMatcher/NestedMatcher.php index 9ddbca9c..4fbad035 100644 --- a/src/NestedMatcher/NestedMatcher.php +++ b/src/NestedMatcher/NestedMatcher.php @@ -175,6 +175,10 @@ public function getRouteFilters() */ protected function sortFilters() { + if (0 === count($this->filters)) { + return []; + } + krsort($this->filters); return call_user_func_array('array_merge', $this->filters);