@@ -290,15 +290,15 @@ public static function formatSignalMethod(string $signal): string
290290 /**
291291 * Generates URL to presenter, action or signal.
292292 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
293- * @param array| mixed $args
293+ * @param mixed ... $args
294294 * @throws InvalidLinkException
295295 */
296- public function link (string $ destination , $ args = [] ): string
296+ public function link (string $ destination , ... $ args ): string
297297 {
298298 try {
299- $ args = func_num_args () < 3 && is_array ($ args )
300- ? $ args
301- : array_slice ( func_get_args (), 1 ) ;
299+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
300+ ? $ args[ 0 ]
301+ : $ args ;
302302 return $ this ->getPresenter ()->getLinkGenerator ()->link ($ destination , $ args , $ this , 'link ' );
303303
304304 } catch (InvalidLinkException $ e ) {
@@ -310,29 +310,29 @@ public function link(string $destination, $args = []): string
310310 /**
311311 * Returns destination as Link object.
312312 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
313- * @param array| mixed $args
313+ * @param mixed ... $args
314314 */
315- public function lazyLink (string $ destination , $ args = [] ): Link
315+ public function lazyLink (string $ destination , ... $ args ): Link
316316 {
317- $ args = func_num_args () < 3 && is_array ($ args )
318- ? $ args
319- : array_slice ( func_get_args (), 1 ) ;
317+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
318+ ? $ args[ 0 ]
319+ : $ args ;
320320 return new Link ($ this , $ destination , $ args );
321321 }
322322
323323
324324 /**
325325 * Determines whether it links to the current page.
326326 * @param ?string $destination in format "[[[module:]presenter:]action | signal! | this]"
327- * @param array| mixed $args
327+ * @param mixed ... $args
328328 * @throws InvalidLinkException
329329 */
330- public function isLinkCurrent (?string $ destination = null , $ args = [] ): bool
330+ public function isLinkCurrent (?string $ destination = null , ... $ args ): bool
331331 {
332332 if ($ destination !== null ) {
333- $ args = func_num_args () < 3 && is_array ($ args )
334- ? $ args
335- : array_slice ( func_get_args (), 1 ) ;
333+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
334+ ? $ args[ 0 ]
335+ : $ args ;
336336 $ this ->getPresenter ()->getLinkGenerator ()->createRequest ($ this , $ destination , $ args , 'test ' );
337337 }
338338
@@ -343,14 +343,14 @@ public function isLinkCurrent(?string $destination = null, $args = []): bool
343343 /**
344344 * Redirect to another presenter, action or signal.
345345 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
346- * @param array| mixed $args
346+ * @param mixed ... $args
347347 * @throws Nette\Application\AbortException
348348 */
349- public function redirect (string $ destination , $ args = [] ): never
349+ public function redirect (string $ destination , ... $ args ): never
350350 {
351- $ args = func_num_args () < 3 && is_array ($ args )
352- ? $ args
353- : array_slice ( func_get_args (), 1 ) ;
351+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
352+ ? $ args[ 0 ]
353+ : $ args ;
354354 $ presenter = $ this ->getPresenter ();
355355 $ presenter ->saveGlobalState ();
356356 $ presenter ->redirectUrl ($ presenter ->getLinkGenerator ()->link ($ destination , $ args , $ this , 'redirect ' ));
@@ -360,14 +360,14 @@ public function redirect(string $destination, $args = []): never
360360 /**
361361 * Permanently redirects to presenter, action or signal.
362362 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
363- * @param array| mixed $args
363+ * @param mixed ... $args
364364 * @throws Nette\Application\AbortException
365365 */
366- public function redirectPermanent (string $ destination , $ args = [] ): never
366+ public function redirectPermanent (string $ destination , ... $ args ): never
367367 {
368- $ args = func_num_args () < 3 && is_array ($ args )
369- ? $ args
370- : array_slice ( func_get_args (), 1 ) ;
368+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
369+ ? $ args[ 0 ]
370+ : $ args ;
371371 $ presenter = $ this ->getPresenter ();
372372 $ presenter ->redirectUrl (
373373 $ presenter ->getLinkGenerator ()->link ($ destination , $ args , $ this , 'redirect ' ),
0 commit comments