Skip to content

Commit cdc1b15

Browse files
committed
Fixed passing no arguments to array_merge
1 parent 580f90e commit cdc1b15

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/ChainRouteCollection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ public function setMethods($methods)
241241
*/
242242
public function getResources()
243243
{
244+
if (0 === count($this->routeCollections)) {
245+
return [];
246+
}
247+
244248
$resources = array_map(function (RouteCollection $routeCollection) {
245249
return $routeCollection->getResources();
246250
}, $this->routeCollections);

src/ChainRouter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ public function all()
124124
*/
125125
protected function sortRouters()
126126
{
127-
krsort($this->routers);
128-
129127
if (0 === count($this->routers)) {
130128
return [];
131129
}
132130

131+
krsort($this->routers);
132+
133133
return call_user_func_array('array_merge', $this->routers);
134134
}
135135

src/DynamicRouter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,12 @@ public function getRouteEnhancers()
348348
*/
349349
protected function sortRouteEnhancers()
350350
{
351-
krsort($this->enhancers);
352-
353351
if (0 === count($this->enhancers)) {
354352
return [];
355353
}
356354

355+
krsort($this->enhancers);
356+
357357
return call_user_func_array('array_merge', $this->enhancers);
358358
}
359359

src/NestedMatcher/NestedMatcher.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ public function getRouteFilters()
175175
*/
176176
protected function sortFilters()
177177
{
178+
if (0 === count($this->filters)) {
179+
return [];
180+
}
181+
178182
krsort($this->filters);
179183

180184
return call_user_func_array('array_merge', $this->filters);

0 commit comments

Comments
 (0)