Skip to content

Commit 24ead35

Browse files
committed
Component::redirect() removed $code from signature [Closes #220][Closes #221]
1 parent d1378d4 commit 24ead35

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Application/UI/Component.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,17 +280,17 @@ public function isLinkCurrent(string $destination = null, $args = []): bool
280280
* @param array|mixed $args
281281
* @throws Nette\Application\AbortException
282282
*/
283-
public function redirect($code, $destination = null, $args = []): void
283+
public function redirect(/*int $code, string */$destination, $args = []): void
284284
{
285-
if (is_numeric($code)) {
285+
if (is_numeric($destination)) {
286286
trigger_error(__METHOD__ . '() first parameter $code is deprecated; use redirectPermanent() for 301 redirect.', E_USER_DEPRECATED);
287+
[$code, $destination, $args] = func_get_args() + [null, null, []];
287288
if (func_num_args() > 3 || !is_array($args)) {
288289
$args = array_slice(func_get_args(), 2);
289290
}
290-
} elseif (!is_numeric($code)) { // first parameter is optional
291-
$args = func_num_args() < 3 && is_array($destination) ? $destination : array_slice(func_get_args(), 1);
292-
$destination = $code;
291+
} else {
293292
$code = null;
293+
$args = func_num_args() < 3 && is_array($args) ? $args : array_slice(func_get_args(), 1);
294294
}
295295

296296
$presenter = $this->getPresenter();

0 commit comments

Comments
 (0)