From cdc1b15481866db5047827e92d199f40a6d003fb Mon Sep 17 00:00:00 2001 From: WouterJ Date: Tue, 31 Jan 2017 12:17:10 +0100 Subject: [PATCH] Fixed passing no arguments to array_merge --- src/ChainRouteCollection.php | 4 ++++ src/ChainRouter.php | 4 ++-- src/DynamicRouter.php | 4 ++-- src/NestedMatcher/NestedMatcher.php | 4 ++++ 4 files changed, 12 insertions(+), 4 deletions(-) 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);