* 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 ...$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;
* 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|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 );
}
/**
/**
* Returns a new instance of Command class
*
- * @param string|string[] $command String or array of strings representing the command to
+ * @param string|string[] ...$commands String or array of strings representing the command to
* be executed, each value will be escaped.
* Example: [ 'convert', '-font', 'font name' ] would produce "'convert' '-font' 'font name'"
* @return Command
*/
- public static function command( $command ) {
- $args = func_get_args();
- if ( count( $args ) === 1 && is_array( reset( $args ) ) ) {
+ public static function command( ...$commands ) {
+ if ( count( $commands ) === 1 && is_array( reset( $commands ) ) ) {
// If only one argument has been passed, and that argument is an array,
// treat it as a list of arguments
- $args = reset( $args );
+ $commands = reset( $commands );
}
$command = MediaWikiServices::getInstance()
->getShellCommandFactory()
->create();
- return $command->params( $args );
+ return $command->params( $commands );
}
/**
* (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, or a single array of
- * strings parameter. Null values are ignored.
+ * @param string|string[] ...$args strings to escape and glue together, or a single
+ * array of strings parameter. Null values are ignored.
* @return string
*/
- public static function escape( /* ... */ ) {
- $args = func_get_args();
+ public static function escape( ...$args ) {
if ( count( $args ) === 1 && is_array( reset( $args ) ) ) {
// If only one argument has been passed, and that argument is an array,
// treat it as a list of arguments