@@ -237,15 +237,15 @@ public static function formatSignalMethod(string $signal): string
237237 /**
238238 * Generates URL to presenter, action or signal.
239239 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
240- * @param array| mixed $args
240+ * @param mixed ... $args
241241 * @throws InvalidLinkException
242242 */
243- public function link (string $ destination , $ args = [] ): string
243+ public function link (string $ destination , ... $ args ): string
244244 {
245245 try {
246- $ args = func_num_args () < 3 && is_array ($ args )
247- ? $ args
248- : array_slice ( func_get_args (), 1 ) ;
246+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
247+ ? $ args[ 0 ]
248+ : $ args ;
249249 return $ this ->getPresenter ()->createRequest ($ this , $ destination , $ args , 'link ' );
250250
251251 } catch (InvalidLinkException $ e ) {
@@ -257,29 +257,29 @@ public function link(string $destination, $args = []): string
257257 /**
258258 * Returns destination as Link object.
259259 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
260- * @param array| mixed $args
260+ * @param mixed ... $args
261261 */
262- public function lazyLink (string $ destination , $ args = [] ): Link
262+ public function lazyLink (string $ destination , ... $ args ): Link
263263 {
264- $ args = func_num_args () < 3 && is_array ($ args )
265- ? $ args
266- : array_slice ( func_get_args (), 1 ) ;
264+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
265+ ? $ args[ 0 ]
266+ : $ args ;
267267 return new Link ($ this , $ destination , $ args );
268268 }
269269
270270
271271 /**
272272 * Determines whether it links to the current page.
273273 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
274- * @param array| mixed $args
274+ * @param mixed ... $args
275275 * @throws InvalidLinkException
276276 */
277- public function isLinkCurrent (string $ destination = null , $ args = [] ): bool
277+ public function isLinkCurrent (string $ destination = null , ... $ args ): bool
278278 {
279279 if ($ destination !== null ) {
280- $ args = func_num_args () < 3 && is_array ($ args )
281- ? $ args
282- : array_slice ( func_get_args (), 1 ) ;
280+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
281+ ? $ args[ 0 ]
282+ : $ args ;
283283 $ this ->getPresenter ()->createRequest ($ this , $ destination , $ args , 'test ' );
284284 }
285285 return $ this ->getPresenter ()->getLastCreatedRequestFlag ('current ' );
@@ -289,14 +289,14 @@ public function isLinkCurrent(string $destination = null, $args = []): bool
289289 /**
290290 * Redirect to another presenter, action or signal.
291291 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
292- * @param array| mixed $args
292+ * @param mixed ... $args
293293 * @throws Nette\Application\AbortException
294294 */
295- public function redirect (string $ destination , $ args = [] ): void
295+ public function redirect (string $ destination , ... $ args ): void
296296 {
297- $ args = func_num_args () < 3 && is_array ($ args )
298- ? $ args
299- : array_slice ( func_get_args (), 1 ) ;
297+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
298+ ? $ args[ 0 ]
299+ : $ args ;
300300 $ presenter = $ this ->getPresenter ();
301301 $ presenter ->redirectUrl ($ presenter ->createRequest ($ this , $ destination , $ args , 'redirect ' ));
302302 }
@@ -305,14 +305,14 @@ public function redirect(string $destination, $args = []): void
305305 /**
306306 * Permanently redirects to presenter, action or signal.
307307 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
308- * @param array| mixed $args
308+ * @param mixed ... $args
309309 * @throws Nette\Application\AbortException
310310 */
311- public function redirectPermanent (string $ destination , $ args = [] ): void
311+ public function redirectPermanent (string $ destination , ... $ args ): void
312312 {
313- $ args = func_num_args () < 3 && is_array ($ args )
314- ? $ args
315- : array_slice ( func_get_args (), 1 ) ;
313+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
314+ ? $ args[ 0 ]
315+ : $ args ;
316316 $ presenter = $ this ->getPresenter ();
317317 $ presenter ->redirectUrl (
318318 $ presenter ->createRequest ($ this , $ destination , $ args , 'redirect ' ),
0 commit comments