Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 24667d4

Browse files
committed
Fix deprecation notice with zend-expressive-router 2.4 for config driven apps
1 parent 98d1c2d commit 24667d4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/ApplicationConfigInjectionTrait.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
namespace Zend\Expressive;
99

1010
use SplPriorityQueue;
11-
use Zend\Expressive\Router\Route;
1211

1312
trait ApplicationConfigInjectionTrait
1413
{
@@ -152,7 +151,7 @@ public function injectRoutesFromConfig(array $config = null)
152151
continue;
153152
}
154153

155-
$methods = Route::HTTP_METHOD_ANY;
154+
$methods = null;
156155
if (isset($spec['allowed_methods'])) {
157156
$methods = $spec['allowed_methods'];
158157
if (! is_array($methods)) {
@@ -164,7 +163,7 @@ public function injectRoutesFromConfig(array $config = null)
164163
}
165164

166165
$name = isset($spec['name']) ? $spec['name'] : null;
167-
$route = new Route($spec['path'], $spec['middleware'], $methods, $name);
166+
$route = $this->route($spec['path'], $spec['middleware'], $methods, $name);
168167

169168
if (isset($spec['options'])) {
170169
$options = $spec['options'];
@@ -177,8 +176,6 @@ public function injectRoutesFromConfig(array $config = null)
177176

178177
$route->setOptions($options);
179178
}
180-
181-
$this->route($route);
182179
}
183180
}
184181

0 commit comments

Comments
 (0)