@@ -61,9 +61,6 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
61
61
* Inspects the configuration provided to determine if a middleware pipeline
62
62
* exists to inject in the application.
63
63
*
64
- * If no pipeline is defined, but routes *are*, then the method will inject
65
- * the routing and dispatch middleware.
66
- *
67
64
* Use the following configuration format:
68
65
*
69
66
* <code>
@@ -129,7 +126,38 @@ public static function injectPipelineFromConfig(Application $application, array
129
126
/**
130
127
* Inject routes from configuration.
131
128
*
132
- * Proxies to ApplicationConfigInjectionDelegator::injectRoutesFromConfig
129
+ * Introspects the provided configuration for routes to inject in the
130
+ * application instance.
131
+ *
132
+ * The following configuration structure can be used to define routes:
133
+ *
134
+ * <code>
135
+ * return [
136
+ * 'routes' => [
137
+ * [
138
+ * 'path' => '/path/to/match',
139
+ * 'middleware' => 'Middleware Service Name or Callable',
140
+ * 'allowed_methods' => ['GET', 'POST', 'PATCH'],
141
+ * 'options' => [
142
+ * 'stuff' => 'to',
143
+ * 'pass' => 'to',
144
+ * 'the' => 'underlying router',
145
+ * ],
146
+ * ],
147
+ * // etc.
148
+ * ],
149
+ * ];
150
+ * </code>
151
+ *
152
+ * Each route MUST have a path and middleware key at the minimum.
153
+ *
154
+ * The "allowed_methods" key may be omitted, can be either an array or the
155
+ * value of the Zend\Expressive\Router\Route::HTTP_METHOD_ANY constant; any
156
+ * valid HTTP method token is allowed, which means you can specify custom HTTP
157
+ * methods as well.
158
+ *
159
+ * The "options" key may also be omitted, and its interpretation will be
160
+ * dependent on the underlying router used.
133
161
*
134
162
* @throws InvalidArgumentException
135
163
*/
@@ -144,7 +172,7 @@ public static function injectRoutesFromConfig(Application $application, array $c
144
172
continue ;
145
173
}
146
174
147
- $ methods = null ;
175
+ $ methods = Route:: HTTP_METHOD_ANY ;
148
176
if (isset ($ spec ['allowed_methods ' ])) {
149
177
$ methods = $ spec ['allowed_methods ' ];
150
178
if (! is_array ($ methods )) {
0 commit comments