Skip to content

Commit

Permalink
Fix up phpstan errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 10, 2017
1 parent bc14b17 commit 5155c08
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Routing/Dispatcher.php
Expand Up @@ -65,7 +65,7 @@ public function dispatch(ServerRequest $request, Response $response)
);
$actionDispatcher = new ActionDispatcher(null, $this->getEventManager(), $this->_filters);
$response = $actionDispatcher->dispatch($request, $response);
if (isset($request->params['return'])) {
if ($request->getParam('return')) {
return $response->body();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Routing/RequestActionTrait.php
Expand Up @@ -136,8 +136,8 @@ public function requestAction($url, array $extra = [])
}
$current = Router::getRequest();
if ($current) {
$params['base'] = $current->base;
$params['webroot'] = $current->webroot;
$params['base'] = $current->getAttribute('base');
$params['webroot'] = $current->getAttribute('webroot');
}

$params['post'] = $params['query'] = [];
Expand Down
12 changes: 4 additions & 8 deletions src/Routing/Router.php
Expand Up @@ -902,17 +902,15 @@ public static function parseNamedParams(ServerRequest $request, array $options =
'2.x backwards compatible named parameter support will be removed in 4.0'
);
$options += ['separator' => ':'];
if (empty($request->params['pass'])) {
$request->params['named'] = [];

return $request;
if (!$request->getParam('pass')) {
return $request->withParam('named', []);
}
$named = [];
foreach ($request->getParam('pass') as $key => $value) {
if (strpos($value, $options['separator']) === false) {
continue;
}
unset($request->params['pass'][$key]);
$request = $request->withoutParam("pass.{$key}");
list($key, $value) = explode($options['separator'], $value, 2);

if (preg_match_all('/\[([A-Za-z0-9_-]+)?\]/', $key, $matches, PREG_SET_ORDER)) {
Expand All @@ -933,9 +931,7 @@ public static function parseNamedParams(ServerRequest $request, array $options =
}
$named = array_merge_recursive($named, [$key => $value]);
}
$request->params['named'] = $named;

return $request;
return $request->withParam('named', $named);
}

/**
Expand Down

0 comments on commit 5155c08

Please sign in to comment.