Skip to content

Commit 97f2bdb

Browse files
committed
Drop null parameter from redirectAfterLogin()
The helper always has a sensible default ('/'), so accepting null as an explicit argument added no value and required a dead null-check branch. The return type stays nullable because Controller::redirect() itself can return null when a beforeRedirect event cancels the redirect.
1 parent 44d05bf commit 97f2bdb

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/Controller/Component/AuthenticationComponent.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,12 @@ public function getLoginRedirect(array|string|null $default = null): ?string
379379
* controller's redirect method so applications can use the plugin's
380380
* existing safe redirect parsing without manually reading query params.
381381
*
382-
* @param array|string|null $default Default URL to use when no valid login redirect is available.
382+
* @param array|string $default Default URL to use when no valid login redirect is available.
383383
* @return \Cake\Http\Response|null
384384
*/
385-
public function redirectAfterLogin(array|string|null $default = '/'): ?Response
385+
public function redirectAfterLogin(array|string $default = '/'): ?Response
386386
{
387387
$target = $this->getLoginRedirect($default) ?? $default;
388-
if ($target === null) {
389-
return null;
390-
}
391388

392389
return $this->getController()->redirect($target);
393390
}

0 commit comments

Comments
 (0)