@@ -252,15 +252,15 @@ public static function formatSignalMethod(string $signal): string
252252 /**
253253 * Generates URL to presenter, action or signal.
254254 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
255- * @param array| mixed $args
255+ * @param mixed ... $args
256256 * @throws InvalidLinkException
257257 */
258- public function link (string $ destination , $ args = [] ): string
258+ public function link (string $ destination , ... $ args ): string
259259 {
260260 try {
261- $ args = func_num_args () < 3 && is_array ($ args )
262- ? $ args
263- : array_slice ( func_get_args (), 1 ) ;
261+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
262+ ? $ args[ 0 ]
263+ : $ args ;
264264 return $ this ->getPresenter ()->getLinkGenerator ()->link ($ destination , $ args , $ this , 'link ' );
265265
266266 } catch (InvalidLinkException $ e ) {
@@ -272,29 +272,29 @@ public function link(string $destination, $args = []): string
272272 /**
273273 * Returns destination as Link object.
274274 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
275- * @param array| mixed $args
275+ * @param mixed ... $args
276276 */
277- public function lazyLink (string $ destination , $ args = [] ): Link
277+ public function lazyLink (string $ destination , ... $ args ): Link
278278 {
279- $ args = func_num_args () < 3 && is_array ($ args )
280- ? $ args
281- : array_slice ( func_get_args (), 1 ) ;
279+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
280+ ? $ args[ 0 ]
281+ : $ args ;
282282 return new Link ($ this , $ destination , $ args );
283283 }
284284
285285
286286 /**
287287 * Determines whether it links to the current page.
288288 * @param string $destination in format "[[[module:]presenter:]action | signal! | this]"
289- * @param array| mixed $args
289+ * @param mixed ... $args
290290 * @throws InvalidLinkException
291291 */
292- public function isLinkCurrent (?string $ destination = null , $ args = [] ): bool
292+ public function isLinkCurrent (?string $ destination = null , ... $ args ): bool
293293 {
294294 if ($ destination !== null ) {
295- $ args = func_num_args () < 3 && is_array ($ args )
296- ? $ args
297- : array_slice ( func_get_args (), 1 ) ;
295+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
296+ ? $ args[ 0 ]
297+ : $ args ;
298298 $ this ->getPresenter ()->getLinkGenerator ()->createRequest ($ this , $ destination , $ args , 'test ' );
299299 }
300300
@@ -305,14 +305,14 @@ public function isLinkCurrent(?string $destination = null, $args = []): bool
305305 /**
306306 * Redirect to another 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 redirect (string $ destination , $ args = [] ): never
311+ public function redirect (string $ destination , ... $ args ): never
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 ->saveGlobalState ();
318318 $ presenter ->redirectUrl ($ presenter ->getLinkGenerator ()->link ($ destination , $ args , $ this , 'redirect ' ));
@@ -322,14 +322,14 @@ public function redirect(string $destination, $args = []): never
322322 /**
323323 * Permanently redirects to presenter, action or signal.
324324 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
325- * @param array| mixed $args
325+ * @param mixed ... $args
326326 * @throws Nette\Application\AbortException
327327 */
328- public function redirectPermanent (string $ destination , $ args = [] ): never
328+ public function redirectPermanent (string $ destination , ... $ args ): never
329329 {
330- $ args = func_num_args () < 3 && is_array ($ args )
331- ? $ args
332- : array_slice ( func_get_args (), 1 ) ;
330+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
331+ ? $ args[ 0 ]
332+ : $ args ;
333333 $ presenter = $ this ->getPresenter ();
334334 $ presenter ->redirectUrl (
335335 $ presenter ->getLinkGenerator ()->link ($ destination , $ args , $ this , 'redirect ' ),
0 commit comments