From 24ead35a66b6591a668dced08626c45651510bf0 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 7 Jul 2019 23:24:55 +0200 Subject: [PATCH] Component::redirect() removed $code from signature [Closes #220][Closes #221] --- src/Application/UI/Component.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Application/UI/Component.php b/src/Application/UI/Component.php index bbf48d343..c170c00d2 100644 --- a/src/Application/UI/Component.php +++ b/src/Application/UI/Component.php @@ -280,17 +280,17 @@ public function isLinkCurrent(string $destination = null, $args = []): bool * @param array|mixed $args * @throws Nette\Application\AbortException */ - public function redirect($code, $destination = null, $args = []): void + public function redirect(/*int $code, string */$destination, $args = []): void { - if (is_numeric($code)) { + if (is_numeric($destination)) { trigger_error(__METHOD__ . '() first parameter $code is deprecated; use redirectPermanent() for 301 redirect.', E_USER_DEPRECATED); + [$code, $destination, $args] = func_get_args() + [null, null, []]; if (func_num_args() > 3 || !is_array($args)) { $args = array_slice(func_get_args(), 2); } - } elseif (!is_numeric($code)) { // first parameter is optional - $args = func_num_args() < 3 && is_array($destination) ? $destination : array_slice(func_get_args(), 1); - $destination = $code; + } else { $code = null; + $args = func_num_args() < 3 && is_array($args) ? $args : array_slice(func_get_args(), 1); } $presenter = $this->getPresenter();