You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -181,6 +183,7 @@ private function extractSegments($route, $template, &$required) {
181
183
$prevGlued = false;
182
184
$segmentPattern = '';
183
185
$optional = false;
186
+
$catchAll = false;
184
187
$default = null;
185
188
186
189
// parse name
@@ -201,9 +204,32 @@ private function extractSegments($route, $template, &$required) {
201
204
$name = $name[0];
202
205
}
203
206
207
+
// is catch-all
208
+
if (count($name = explode('*', $name)) > 1) {
209
+
$catchAll = true;
210
+
$name = $name[1];
211
+
}
212
+
else {
213
+
$name = $name[0];
214
+
}
215
+
216
+
if ($catchAll && $i != $count - 1) {
217
+
thrownewRouteParsingException(
218
+
$this,
219
+
'A catch-all parameter can only appear as the last segment of the route template. ' .
220
+
'Please check the route parameter "' . $name . '" in the route "' . $this->name . '".'
221
+
);
222
+
}
223
+
204
224
// default value is allowed or not
205
225
if (!empty($default) && !empty($route->defaults[$name])) {
206
-
thrownew \Exception('The route parameter "' . $name . '" has both an inline default value and an explicit default value specified. A route parameter must not contain an inline default value when a default value is specified explicitly. Consider removing one of them.');
226
+
thrownewRouteParsingException(
227
+
$this,
228
+
'The route parameter "' . $name . '" in the route "' . $this->name . '" ' .
229
+
'has both an inline default value and an explicit default value specified. ' .
230
+
'A route parameter must not contain an inline default value when a default value is specified explicitly. ' .
0 commit comments