X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FGlobalFunctions.php;h=d9996f426fab95285c21b1c5d6cb12d2508ba608;hb=3714131b5dc26794512b0e9f59999a9eeb9bf7e2;hp=8fcd11ef821ee93b8e88f5ce633bc5975380bfc2;hpb=369b34f0ae64076b91df63e7432f5bf6f19a76a6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 8fcd11ef82..d9996f426f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1336,21 +1336,19 @@ function wfGetLangObj( $langcode = false ) { * This function replaces all old wfMsg* functions. * * @param string|string[]|MessageSpecifier $key Message key, or array of keys, or a MessageSpecifier - * @param mixed $params,... Normal message parameters + * @param string|string[] ...$params Normal message parameters * @return Message * * @since 1.17 * * @see Message::__construct */ -function wfMessage( $key /*...*/ ) { +function wfMessage( $key, ...$params ) { $message = new Message( $key ); // We call Message::params() to reduce code duplication - $params = func_get_args(); - array_shift( $params ); if ( $params ) { - call_user_func_array( [ $message, 'params' ], $params ); + $message->params( ...$params ); } return $message; @@ -1361,16 +1359,15 @@ function wfMessage( $key /*...*/ ) { * for the first message which is non-empty. If all messages are empty then an * instance of the first message key is returned. * - * @param string|string[] $keys,... Message keys + * @param string ...$keys Message keys * @return Message * * @since 1.18 * * @see Message::newFallbackSequence */ -function wfMessageFallback( /*...*/ ) { - $args = func_get_args(); - return call_user_func_array( 'Message::newFallbackSequence', $args ); +function wfMessageFallback( ...$keys ) { + return Message::newFallbackSequence( ...$keys ); } /** @@ -2199,9 +2196,7 @@ function wfStringToBool( $val ) { * @deprecated since 1.30 use MediaWiki\Shell::escape() */ function wfEscapeShellArg( /*...*/ ) { - $args = func_get_args(); - - return call_user_func_array( Shell::class . '::escape', $args ); + return Shell::escape( ...func_get_args() ); } /** @@ -2304,7 +2299,7 @@ function wfShellWikiCmd( $script, array $parameters = [], array $options = [] ) // Give site config file a chance to run the script in a wrapper. // The caller may likely want to call wfBasename() on $script. Hooks::run( 'wfShellWikiCmd', [ &$script, &$parameters, &$options ] ); - $cmd = isset( $options['php'] ) ? [ $options['php'] ] : [ $wgPhpCli ]; + $cmd = [ $options['php'] ?? $wgPhpCli ]; if ( isset( $options['wrapper'] ) ) { $cmd[] = $options['wrapper']; } @@ -2700,10 +2695,7 @@ function wfMakeStaticArrayFile( array $data, $header = 'Automatically generated' * @return string */ function wfMemcKey( /*...*/ ) { - return call_user_func_array( - [ ObjectCache::getLocalClusterInstance(), 'makeKey' ], - func_get_args() - ); + return ObjectCache::getLocalClusterInstance()->makeKey( ...func_get_args() ); } /** @@ -2719,10 +2711,7 @@ function wfMemcKey( /*...*/ ) { function wfForeignMemcKey( $db, $prefix /*...*/ ) { $args = array_slice( func_get_args(), 2 ); $keyspace = $prefix ? "$db-$prefix" : $db; - return call_user_func_array( - [ ObjectCache::getLocalClusterInstance(), 'makeKeyInternal' ], - [ $keyspace, $args ] - ); + return ObjectCache::getLocalClusterInstance()->makeKeyInternal( $keyspace, $args ); } /** @@ -2738,10 +2727,7 @@ function wfForeignMemcKey( $db, $prefix /*...*/ ) { * @return string */ function wfGlobalCacheKey( /*...*/ ) { - return call_user_func_array( - [ ObjectCache::getLocalClusterInstance(), 'makeGlobalKey' ], - func_get_args() - ); + return ObjectCache::getLocalClusterInstance()->makeGlobalKey( ...func_get_args() ); } /**