Skip to content

Commit 5c6e1d9

Browse files
committed
refactor: stop reassignment
1 parent aed300c commit 5c6e1d9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

system/Router/RouteCollection.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,12 +604,14 @@ public function addRedirect(string $from, string $to, int $status = 302)
604604
{
605605
// Use the named route's pattern if this is a named route.
606606
if (array_key_exists($to, $this->routes['*'])) {
607-
$to = $this->routes['*'][$to]['route'];
607+
$redirectTo = $this->routes['*'][$to]['route'];
608608
} elseif (array_key_exists($to, $this->routes['get'])) {
609-
$to = $this->routes['get'][$to]['route'];
609+
$redirectTo = $this->routes['get'][$to]['route'];
610+
} else {
611+
$redirectTo = $to;
610612
}
611613

612-
$this->create('*', $from, $to, ['redirect' => $status]);
614+
$this->create('*', $from, $redirectTo, ['redirect' => $status]);
613615

614616
return $this;
615617
}

0 commit comments

Comments
 (0)