@@ -234,15 +234,15 @@ public static function formatSignalMethod(string $signal): string
234234 /**
235235 * Generates URL to presenter, action or signal.
236236 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
237- * @param array| mixed $args
237+ * @param mixed ... $args
238238 * @throws InvalidLinkException
239239 */
240- public function link (string $ destination , $ args = [] ): string
240+ public function link (string $ destination , ... $ args ): string
241241 {
242242 try {
243- $ args = func_num_args () < 3 && is_array ($ args )
244- ? $ args
245- : array_slice ( func_get_args (), 1 ) ;
243+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
244+ ? $ args[ 0 ]
245+ : $ args ;
246246 return $ this ->getPresenter ()->createRequest ($ this , $ destination , $ args , 'link ' );
247247
248248 } catch (InvalidLinkException $ e ) {
@@ -254,29 +254,29 @@ public function link(string $destination, $args = []): string
254254 /**
255255 * Returns destination as Link object.
256256 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
257- * @param array| mixed $args
257+ * @param mixed ... $args
258258 */
259- public function lazyLink (string $ destination , $ args = [] ): Link
259+ public function lazyLink (string $ destination , ... $ args ): Link
260260 {
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 new Link ($ this , $ destination , $ args );
265265 }
266266
267267
268268 /**
269269 * Determines whether it links to the current page.
270270 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
271- * @param array| mixed $args
271+ * @param mixed ... $args
272272 * @throws InvalidLinkException
273273 */
274- public function isLinkCurrent (string $ destination = null , $ args = [] ): bool
274+ public function isLinkCurrent (string $ destination = null , ... $ args ): bool
275275 {
276276 if ($ destination !== null ) {
277- $ args = func_num_args () < 3 && is_array ($ args )
278- ? $ args
279- : array_slice ( func_get_args (), 1 ) ;
277+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
278+ ? $ args[ 0 ]
279+ : $ args ;
280280 $ this ->getPresenter ()->createRequest ($ this , $ destination , $ args , 'test ' );
281281 }
282282 return $ this ->getPresenter ()->getLastCreatedRequestFlag ('current ' );
@@ -286,14 +286,14 @@ public function isLinkCurrent(string $destination = null, $args = []): bool
286286 /**
287287 * Redirect to another presenter, action or signal.
288288 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
289- * @param array| mixed $args
289+ * @param mixed ... $args
290290 * @throws Nette\Application\AbortException
291291 */
292- public function redirect (string $ destination , $ args = [] ): void
292+ public function redirect (string $ destination , ... $ args ): void
293293 {
294- $ args = func_num_args () < 3 && is_array ($ args )
295- ? $ args
296- : array_slice ( func_get_args (), 1 ) ;
294+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
295+ ? $ args[ 0 ]
296+ : $ args ;
297297 $ presenter = $ this ->getPresenter ();
298298 $ presenter ->redirectUrl ($ presenter ->createRequest ($ this , $ destination , $ args , 'redirect ' ));
299299 }
@@ -302,14 +302,14 @@ public function redirect(string $destination, $args = []): void
302302 /**
303303 * Permanently redirects to presenter, action or signal.
304304 * @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
305- * @param array| mixed $args
305+ * @param mixed ... $args
306306 * @throws Nette\Application\AbortException
307307 */
308- public function redirectPermanent (string $ destination , $ args = [] ): void
308+ public function redirectPermanent (string $ destination , ... $ args ): void
309309 {
310- $ args = func_num_args () < 3 && is_array ($ args )
311- ? $ args
312- : array_slice ( func_get_args (), 1 ) ;
310+ $ args = count ( $ args ) === 1 && is_array ($ args[ 0 ] ?? null )
311+ ? $ args[ 0 ]
312+ : $ args ;
313313 $ presenter = $ this ->getPresenter ();
314314 $ presenter ->redirectUrl (
315315 $ presenter ->createRequest ($ this , $ destination , $ args , 'redirect ' ),
0 commit comments