Skip to content

Commit 5b075da

Browse files
committed
Always pass params to resolved target
Altorouter seems to always populate the params key in its response to `match` so we would never fall into the `else` block. Have refactored to make the code simpler and more consistent.
1 parent 830ade2 commit 5b075da

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/Router.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,8 @@ public function match(Request $request)
104104
}
105105

106106
// Call the target with any resolved params
107-
if (isset($altoRoute['params'])) {
108-
$params = new RouteParams($altoRoute['params']);
109-
$returnValue = call_user_func($altoRoute['target'], $params);
110-
} else {
111-
$returnValue = call_user_func($altoRoute['target']);
112-
}
107+
$params = new RouteParams($altoRoute['params']);
108+
$returnValue = call_user_func($altoRoute['target'], $params);
113109

114110
// Ensure that we return an instance of a Response object
115111
if (!($returnValue instanceof Response)) {

0 commit comments

Comments
 (0)