// Allow for site and per-namespace customization of contribution/copyright notice.
Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsg ] );
- $msg = call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title );
+ $msg = wfMessage( ...$copywarnMsg )->title( $title );
if ( $langcode ) {
$msg->inLanguage( $langcode );
}
* @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() );
}
/**
* @return string
*/
function wfMemcKey( /*...*/ ) {
- return call_user_func_array(
- [ ObjectCache::getLocalClusterInstance(), 'makeKey' ],
- func_get_args()
- );
+ return ObjectCache::getLocalClusterInstance()->makeKey( ...func_get_args() );
}
/**
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 );
}
/**
* @return string
*/
function wfGlobalCacheKey( /*...*/ ) {
- return call_user_func_array(
- [ ObjectCache::getLocalClusterInstance(), 'makeGlobalKey' ],
- func_get_args()
- );
+ return ObjectCache::getLocalClusterInstance()->makeGlobalKey( ...func_get_args() );
}
/**
}
if ( is_callable( $classOrCallable ) ) {
- return call_user_func_array( $classOrCallable, [ $page, $context ] );
+ return $classOrCallable( $page, $context );
}
return $classOrCallable;
*/
final public function msg( $key ) {
$params = func_get_args();
- return call_user_func_array( [ $this->getContext(), 'msg' ], $params );
+ return $this->getContext()->msg( ...$params );
}
/**
if ( is_string( $msg ) ) {
$msg = wfMessage( $msg );
} elseif ( is_array( $msg ) ) {
- $msg = call_user_func_array( 'wfMessage', $msg );
+ $msg = wfMessage( ...$msg );
}
if ( !$msg instanceof Message ) {
return null;
[ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) ]
) );
} else {
- call_user_func_array( [ $status, 'fatal' ], (array)$error );
+ $status->fatal( ...(array)$error );
}
}
return $status;
if ( !$status->getErrorsByType( 'error' ) ) {
$newStatus = Status::newGood();
foreach ( $status->getErrorsByType( 'warning' ) as $err ) {
- call_user_func_array(
- [ $newStatus, 'fatal' ],
- array_merge( [ $err['message'] ], $err['params'] )
- );
+ $newStatus->fatal( $err['message'], ...$err['params'] );
}
if ( !$newStatus->getErrorsByType( 'error' ) ) {
$newStatus->fatal( 'unknownerror-nocode' );
$user = $this->getUser();
}
$rights = (array)$rights;
- if ( !call_user_func_array( [ $user, 'isAllowedAny' ], $rights ) ) {
+ if ( !$user->isAllowedAny( ...$rights ) ) {
$this->dieWithError( [ 'apierror-permissiondenied', $this->msg( "action-{$rights[0]}" ) ] );
}
}
global $wgAuth;
if ( $wgAuth && !$wgAuth instanceof AuthManagerAuthPlugin ) {
- return call_user_func_array( [ $wgAuth, $method ], $params );
+ return $wgAuth->$method( ...$params );
} else {
return $return;
}
if ( $permErrors ) {
$status = Status::newGood();
foreach ( $permErrors as $args ) {
- call_user_func_array( [ $status, 'fatal' ], $args );
+ $status->fatal( ...$args );
}
return $status;
}
$providers += $this->getSecondaryAuthenticationProviders();
}
foreach ( $providers as $provider ) {
- call_user_func_array( [ $provider, $method ], $args );
+ $provider->$method( ...$args );
}
}
case LoginForm::USER_MIGRATED:
$error = $msg ?: 'login-migrated-generic';
- return call_user_func_array( 'StatusValue::newFatal', (array)$error );
+ return StatusValue::newFatal( ...(array)$error );
// @codeCoverageIgnoreStart
case LoginForm::CREATE_BLOCKED: // Can never happen
if ( is_object( $obj ) && $obj instanceof DependencyWrapper && !$obj->isExpired() ) {
$value = $obj->value;
} elseif ( $callback ) {
- $value = call_user_func_array( $callback, $callbackParams );
+ $value = $callback( ...$callbackParams );
# Cache the newly-generated value
$wrapper = new DependencyWrapper( $value, $deps );
$wrapper->storeToCache( $cache, $key, $expiry );
$args = [ $args ];
}
- $value = call_user_func_array( $computeFunction, $args );
+ $value = $computeFunction( ...$args );
if ( $this->cacheEnabled ) {
if ( is_null( $key ) ) {
throw new MWException( 'No cache key set, so cannot obtain or save the CacheHelper values.' );
}
- return call_user_func_array( 'wfMemcKey', $this->cacheKey );
+ return wfMemcKey( ...$this->cacheKey );
}
/**
}
/** @var RecentChange $rc */
- $rc = call_user_func_array(
- $this->newForCategorizationCallback,
- [
- $timestamp,
- $categoryTitle,
- $user,
- $comment,
- $pageTitle,
- $lastRevId,
- $newRevId,
- $lastTimestamp,
- $bot,
- $ip,
- $deleted,
- $added
- ]
+ $rc = ( $this->newForCategorizationCallback )(
+ $timestamp,
+ $categoryTitle,
+ $user,
+ $comment,
+ $pageTitle,
+ $lastRevId,
+ $newRevId,
+ $lastTimestamp,
+ $bot,
+ $ip,
+ $deleted,
+ $added
);
$rc->save();
}
return;
}
- call_user_func_array(
- $this->queryCallable,
- [
- get_class( $specialPage ),
- $specialPage->getContext(),
- $dbr,
- &$tables,
- &$fields,
- &$conds,
- &$query_options,
- &$join_conds
- ]
+ ( $this->queryCallable )(
+ get_class( $specialPage ),
+ $specialPage->getContext(),
+ $dbr,
+ $tables,
+ $fields,
+ $conds,
+ $query_options,
+ $join_conds
);
}
sort( $selectedValues );
- call_user_func_array(
- $this->queryCallable,
- [
- get_class( $specialPage ),
- $specialPage->getContext(),
- $dbr,
- &$tables,
- &$fields,
- &$conds,
- &$query_options,
- &$join_conds,
- $selectedValues
- ]
+ ( $this->queryCallable )(
+ get_class( $specialPage ),
+ $specialPage->getContext(),
+ $dbr,
+ $tables,
+ $fields,
+ $conds,
+ $query_options,
+ $join_conds,
+ $selectedValues
);
}
public function msg( $key /* $args */ ) {
$args = func_get_args();
- return call_user_func_array( [ $this->getContext(), 'msg' ], $args );
+ return $this->getContext()->msg( ...$args );
}
/**
public function msg( $key ) {
$args = func_get_args();
- return call_user_func_array( 'wfMessage', $args )->setContext( $this );
+ return wfMessage( ...$args )->setContext( $this );
}
}
public function msg( $key ) {
$args = func_get_args();
- return call_user_func_array( 'wfMessage', $args )->setContext( $this );
+ return wfMessage( ...$args )->setContext( $this );
}
/**
if ( isset( $spec['calls'] ) ) {
foreach ( $spec['calls'] as $method => $margs ) {
- call_user_func_array( [ $obj, $method ], $margs );
+ $obj->$method( ...$margs );
}
}
try {
/** @var Exception $e */
$e = null;
- call_user_func_array( $this->callback, [ $this->dbw, $this->fname ] );
+ ( $this->callback )( $this->dbw, $this->fname );
} catch ( Exception $e ) {
}
if ( $autoTrx ) {
// for backwards-compatibility
$key = $this->getDiffBodyCacheKey();
if ( $key === null ) {
- $key = call_user_func_array(
- [ $cache, 'makeKey' ],
- $this->getDiffBodyCacheKeyParams()
- );
+ $key = $cache->makeKey( ...$this->getDiffBodyCacheKeyParams() );
}
// Try cache
* @return Status
*/
public function newFatal( $message /*, parameters...*/ ) {
- $status = call_user_func_array( [ Status::class, 'newFatal' ], func_get_args() );
+ $status = Status::newFatal( ...func_get_args() );
$status->cleanCallback = $this->getErrorCleanupFunction();
return $status;
$args = func_get_args();
array_unshift( $args, 'filerepo', $this->getName() );
- return call_user_func_array( 'wfMemcKey', $args );
+ return wfMemcKey( ...$args );
}
/**
function getSharedCacheKey( /*...*/ ) {
if ( $this->hasSharedCache() ) {
$args = func_get_args();
- array_unshift( $args, $this->dbName, $this->tablePrefix );
- return call_user_func_array( 'wfForeignMemcKey', $args );
+ return wfForeignMemcKey( $this->dbName, $this->tablePrefix, ...$args );
} else {
return false;
}
function getSharedCacheKey( /*...*/ ) {
$args = func_get_args();
- return call_user_func_array( 'wfMemcKey', $args );
+ return wfMemcKey( ...$args );
}
/**
wfDebug( __METHOD__ . ": skipped because storage uses sha1 paths\n" );
return Status::newGood();
} else {
- return call_user_func_array( 'parent::' . $function, $args );
+ return parent::$function( ...$args );
}
}
}
if ( count( $warnings ) !== 0 ) {
foreach ( $warnings as $w ) {
- call_user_func_array( [ $this, 'showMessage' ], $w );
+ $this->showMessage( ...$w );
}
}