Merge "Use varargs in global functions"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 2 Oct 2018 01:04:11 +0000 (01:04 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 2 Oct 2018 01:04:11 +0000 (01:04 +0000)
1  2 
includes/GlobalFunctions.php

@@@ -197,11 -197,10 +197,10 @@@ function wfAppendToArrayIfNotDefault( $
   *       [ 'y' ]
   *     ]
   *
-  * @param array $array1,...
+  * @param array ...$args
   * @return array
   */
- function wfMergeErrorArrays( /*...*/ ) {
-       $args = func_get_args();
+ function wfMergeErrorArrays( ...$args ) {
        $out = [];
        foreach ( $args as $errors ) {
                foreach ( $errors as $params ) {
@@@ -1147,6 -1146,26 +1146,6 @@@ function wfLogWarning( $msg, $callerOff
        MWDebug::warning( $msg, $callerOffset + 1, $level, 'production' );
  }
  
 -/**
 - * Log to a file without getting "file size exceeded" signals.
 - *
 - * Can also log to TCP or UDP with the syntax udp://host:port/prefix. This will
 - * send lines to the specified port, prefixed by the specified prefix and a space.
 - * @since 1.25 support for additional context data
 - *
 - * @param string $text
 - * @param string $file Filename
 - * @param array $context Additional logging context data
 - * @throws MWException
 - * @deprecated since 1.25 Use \MediaWiki\Logger\LegacyLogger::emit or UDPTransport
 - */
 -function wfErrorLog( $text, $file, array $context = [] ) {
 -      wfDeprecated( __METHOD__, '1.25' );
 -      $logger = LoggerFactory::getInstance( 'wfErrorLog' );
 -      $context['destination'] = $file;
 -      $logger->info( trim( $text ), $context );
 -}
 -
  /**
   * @todo document
   * @todo Move logic to MediaWiki.php
@@@ -2176,13 -2195,13 +2175,13 @@@ function wfStringToBool( $val ) 
   * (https://bugs.php.net/bug.php?id=26285) and the locale problems on Linux in
   * PHP 5.2.6+ (bug backported to earlier distro releases of PHP).
   *
-  * @param string $args,... strings to escape and glue together,
+  * @param string|string[] ...$args strings to escape and glue together,
   *  or a single array of strings parameter
   * @return string
   * @deprecated since 1.30 use MediaWiki\Shell::escape()
   */
- function wfEscapeShellArg( /*...*/ ) {
-       return Shell::escape( ...func_get_args() );
+ function wfEscapeShellArg( ...$args ) {
+       return Shell::escape( ...$args );
  }
  
  /**
@@@ -2625,11 -2644,11 +2624,11 @@@ function wfGetPrecompiledData( $name ) 
   * Make a cache key for the local wiki.
   *
   * @deprecated since 1.30 Call makeKey on a BagOStuff instance
-  * @param string $args,...
+  * @param string ...$args
   * @return string
   */
- function wfMemcKey( /*...*/ ) {
-       return ObjectCache::getLocalClusterInstance()->makeKey( ...func_get_args() );
+ function wfMemcKey( ...$args ) {
+       return ObjectCache::getLocalClusterInstance()->makeKey( ...$args );
  }
  
  /**
   *
   * @param string $db
   * @param string $prefix
-  * @param string $args,...
+  * @param string ...$args
   * @return string
   */
- function wfForeignMemcKey( $db, $prefix /*...*/ ) {
-       $args = array_slice( func_get_args(), 2 );
+ function wfForeignMemcKey( $db, $prefix, ...$args ) {
        $keyspace = $prefix ? "$db-$prefix" : $db;
        return ObjectCache::getLocalClusterInstance()->makeKeyInternal( $keyspace, $args );
  }
   *
   * @deprecated since 1.30 Call makeGlobalKey on a BagOStuff instance
   * @since 1.26
-  * @param string $args,...
+  * @param string ...$args
   * @return string
   */
- function wfGlobalCacheKey( /*...*/ ) {
-       return ObjectCache::getLocalClusterInstance()->makeGlobalKey( ...func_get_args() );
+ function wfGlobalCacheKey( ...$args ) {
+       return ObjectCache::getLocalClusterInstance()->makeGlobalKey( ...$args );
  }
  
  /**