diff --git a/includes/MergeHistory.php b/includes/MergeHistory.php index 0e9bb4673d9..4c655ebab53 100644 --- a/includes/MergeHistory.php +++ b/includes/MergeHistory.php @@ -167,7 +167,7 @@ class MergeHistory { // Convert into a Status object if ( $errors ) { foreach ( $errors as $error ) { - call_user_func_array( [ $status, 'fatal' ], $error ); + $status->fatal( ...$error ); } } diff --git a/includes/MovePage.php b/includes/MovePage.php index fc9f6a66766..3210ba8eb0e 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -57,7 +57,7 @@ class MovePage { // Convert into a Status object if ( $errors ) { foreach ( $errors as $error ) { - call_user_func_array( [ $status, 'fatal' ], $error ); + $status->fatal( ...$error ); } } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index c51f6f8ec26..f92f4f38dac 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2645,13 +2645,13 @@ class OutputPage extends ContextSource { foreach ( $errors as $error ) { $text .= '
  • '; - $text .= call_user_func_array( [ $this, 'msg' ], $error )->plain(); + $text .= $this->msg( ...$error )->plain(); $text .= "
  • \n"; } $text .= ''; } else { $text .= "
    \n" . - call_user_func_array( [ $this, 'msg' ], reset( $errors ) )->plain() . + $this->msg( ...reset( $errors ) )->plain() . "\n
    "; } diff --git a/includes/Storage/RevisionRecord.php b/includes/Storage/RevisionRecord.php index ff0a70dd243..66ec2c07a2e 100644 --- a/includes/Storage/RevisionRecord.php +++ b/includes/Storage/RevisionRecord.php @@ -474,7 +474,7 @@ abstract class RevisionRecord { $permissionlist = implode( ', ', $permissions ); if ( $title === null ) { wfDebug( "Checking for $permissionlist due to $field match on $bitfield\n" ); - return call_user_func_array( [ $user, 'isAllowedAny' ], $permissions ); + return $user->isAllowedAny( ...$permissions ); } else { $text = $title->getPrefixedText(); wfDebug( "Checking for $permissionlist on $text due to $field match on $bitfield\n" ); diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index 67bf619c894..144c7582b03 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -103,7 +103,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { if ( $cond ) { $this->addWhere( $cond ); $multiNS = count( $lb->data ) !== 1; - $multiTitle = count( call_user_func_array( 'array_merge', $lb->data ) ) !== 1; + $multiTitle = count( array_merge( ...$lb->data ) ) !== 1; } else { // No titles so no results return; diff --git a/includes/api/ApiQueryTokens.php b/includes/api/ApiQueryTokens.php index e86fdf35331..8854aac0de3 100644 --- a/includes/api/ApiQueryTokens.php +++ b/includes/api/ApiQueryTokens.php @@ -94,7 +94,7 @@ class ApiQueryTokens extends ApiQueryBase { public static function getToken( User $user, MediaWiki\Session\Session $session, $salt ) { if ( is_array( $salt ) ) { $session->persist(); - return call_user_func_array( [ $session, 'getToken' ], $salt ); + return $session->getToken( ...$salt ); } else { return $user->getEditTokenObject( $salt, $session->getRequest() ); } diff --git a/includes/api/ApiQueryUserContribs.php b/includes/api/ApiQueryUserContribs.php index 420d138df7a..fdcaa769323 100644 --- a/includes/api/ApiQueryUserContribs.php +++ b/includes/api/ApiQueryUserContribs.php @@ -306,9 +306,11 @@ class ApiQueryUserContribs extends ApiQueryBase { foreach ( $res as $row ) { $names[$row->user_name] = $row; } - call_user_func_array( - $this->params['dir'] == 'newer' ? 'ksort' : 'krsort', [ &$names, SORT_STRING ] - ); + if ( $this->params['dir'] == 'newer' ) { + ksort( $names, SORT_STRING ); + } else { + krsort( $names, SORT_STRING ); + } $neg = $op === '>' ? -1 : 1; $userIter = call_user_func( function () use ( $names, $fromName, $neg ) { foreach ( $names as $name => $row ) { diff --git a/includes/auth/ButtonAuthenticationRequest.php b/includes/auth/ButtonAuthenticationRequest.php index d274e18f7b1..1268e68de5e 100644 --- a/includes/auth/ButtonAuthenticationRequest.php +++ b/includes/auth/ButtonAuthenticationRequest.php @@ -90,14 +90,14 @@ class ButtonAuthenticationRequest extends AuthenticationRequest { } elseif ( is_string( $data['label'] ) ) { $data['label'] = new \Message( $data['label'] ); } elseif ( is_array( $data['label'] ) ) { - $data['label'] = call_user_func_array( 'Message::newFromKey', $data['label'] ); + $data['label'] = Message::newFromKey( ...$data['label'] ); } if ( !isset( $data['help'] ) ) { $data['help'] = new \RawMessage( '$1', $data['name'] ); } elseif ( is_string( $data['help'] ) ) { $data['help'] = new \Message( $data['help'] ); } elseif ( is_array( $data['help'] ) ) { - $data['help'] = call_user_func_array( 'Message::newFromKey', $data['help'] ); + $data['help'] = Message::newFromKey( ...$data['help'] ); } $ret = new static( $data['name'], $data['label'], $data['help'] ); foreach ( $data as $k => $v ) { diff --git a/includes/exception/MWExceptionHandler.php b/includes/exception/MWExceptionHandler.php index 79f0a233749..9039cfca945 100644 --- a/includes/exception/MWExceptionHandler.php +++ b/includes/exception/MWExceptionHandler.php @@ -173,9 +173,7 @@ class MWExceptionHandler { global $wgPropagateErrors; if ( in_array( $level, self::$fatalErrorTypes ) ) { - return call_user_func_array( - 'MWExceptionHandler::handleFatalError', func_get_args() - ); + return self::handleFatalError( ...func_get_args() ); } // Map error constant to error name (reverse-engineer PHP error diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index 785d30f8a30..e72faa0e30d 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -607,7 +607,7 @@ class HTMLForm extends ContextSource { $hoistedErrors = Status::newGood(); if ( $this->mValidationErrorMessage ) { foreach ( (array)$this->mValidationErrorMessage as $error ) { - call_user_func_array( [ $hoistedErrors, 'fatal' ], $error ); + $hoistedErrors->fatal( ...$error ); } } else { $hoistedErrors->fatal( 'htmlform-invalid-input' ); diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 8fb980791e7..306afc4e93a 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -717,7 +717,7 @@ class WebInstaller extends Installer { */ public function showHelpBox( $msg /*, ... */ ) { $args = func_get_args(); - $html = call_user_func_array( [ $this, 'getHelpBox' ], $args ); + $html = $this->getHelpBox( ...$args ); $this->output->addHTML( $html ); } @@ -742,7 +742,7 @@ class WebInstaller extends Installer { public function showStatusMessage( Status $status ) { $errors = array_merge( $status->getErrorsArray(), $status->getWarningsArray() ); foreach ( $errors as $error ) { - call_user_func_array( [ $this, 'showMessage' ], $error ); + $this->showMessage( ...$error ); } } diff --git a/includes/libs/StatusValue.php b/includes/libs/StatusValue.php index 6f348c2b96e..3bdafe12820 100644 --- a/includes/libs/StatusValue.php +++ b/includes/libs/StatusValue.php @@ -68,7 +68,7 @@ class StatusValue { public static function newFatal( $message /*, parameters...*/ ) { $params = func_get_args(); $result = new static(); - call_user_func_array( [ &$result, 'fatal' ], $params ); + $result->fatal( ...$params ); return $result; } diff --git a/includes/libs/filebackend/FileBackend.php b/includes/libs/filebackend/FileBackend.php index 2d4a772b7e7..785cb726554 100644 --- a/includes/libs/filebackend/FileBackend.php +++ b/includes/libs/filebackend/FileBackend.php @@ -1590,7 +1590,7 @@ abstract class FileBackend implements LoggerAwareInterface { final protected function newStatus() { $args = func_get_args(); if ( count( $args ) ) { - $sv = call_user_func_array( [ StatusValue::class, 'newFatal' ], $args ); + $sv = StatusValue::newFatal( ...$args ); } else { $sv = StatusValue::newGood(); } diff --git a/includes/libs/lockmanager/MemcLockManager.php b/includes/libs/lockmanager/MemcLockManager.php index ebd72de894e..f1f749faa03 100644 --- a/includes/libs/lockmanager/MemcLockManager.php +++ b/includes/libs/lockmanager/MemcLockManager.php @@ -89,7 +89,7 @@ class MemcLockManager extends QuorumLockManager { $memc = $this->getCache( $lockSrv ); // List of affected paths - $paths = call_user_func_array( 'array_merge', array_values( $pathsByType ) ); + $paths = array_merge( ...array_values( $pathsByType ) ); $paths = array_unique( $paths ); // List of affected lock record keys $keys = array_map( [ $this, 'recordKeyForPath' ], $paths ); @@ -164,7 +164,7 @@ class MemcLockManager extends QuorumLockManager { $memc = $this->getCache( $lockSrv ); // List of affected paths - $paths = call_user_func_array( 'array_merge', array_values( $pathsByType ) ); + $paths = array_merge( ...array_values( $pathsByType ) ); $paths = array_unique( $paths ); // List of affected lock record keys $keys = array_map( [ $this, 'recordKeyForPath' ], $paths ); diff --git a/includes/libs/lockmanager/RedisLockManager.php b/includes/libs/lockmanager/RedisLockManager.php index ea9dde7f2a0..a624f0a9710 100644 --- a/includes/libs/lockmanager/RedisLockManager.php +++ b/includes/libs/lockmanager/RedisLockManager.php @@ -76,7 +76,7 @@ class RedisLockManager extends QuorumLockManager { protected function getLocksOnServer( $lockSrv, array $pathsByType ) { $status = StatusValue::newGood(); - $pathList = call_user_func_array( 'array_merge', array_values( $pathsByType ) ); + $pathList = array_merge( ...array_values( $pathsByType ) ); $server = $this->lockServers[$lockSrv]; $conn = $this->redisPool->getConnection( $server, $this->logger ); @@ -171,7 +171,7 @@ LUA; protected function freeLocksOnServer( $lockSrv, array $pathsByType ) { $status = StatusValue::newGood(); - $pathList = call_user_func_array( 'array_merge', array_values( $pathsByType ) ); + $pathList = array_merge( ...array_values( $pathsByType ) ); $server = $this->lockServers[$lockSrv]; $conn = $this->redisPool->getConnection( $server, $this->logger ); diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index 9e4a630bd08..40498cd558c 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -553,7 +553,7 @@ class LogEventsList extends ContextSource { } $permissionlist = implode( ', ', $permissions ); wfDebug( "Checking for $permissionlist due to $field match on $bitfield\n" ); - return call_user_func_array( [ $user, 'isAllowedAny' ], $permissions ); + return $user->isAllowedAny( ...$permissions ); } return true; } diff --git a/includes/media/BitmapHandler.php b/includes/media/BitmapHandler.php index cda037c16d3..4cb7c87ec01 100644 --- a/includes/media/BitmapHandler.php +++ b/includes/media/BitmapHandler.php @@ -228,7 +228,7 @@ class BitmapHandler extends TransformationalImageHandler { $rotation = isset( $params['disableRotation'] ) ? 0 : $this->getRotation( $image ); list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation ); - $cmd = call_user_func_array( 'wfEscapeShellArg', array_merge( + $cmd = wfEscapeShellArg( ...array_merge( [ $wgImageMagickConvertCommand ], $quality, // Specify white background color, will be used for transparent images diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 8df5b5ba09e..15ed93c5ff2 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3435,7 +3435,7 @@ class Parser { } } - $result = call_user_func_array( $callback, $allArgs ); + $result = $callback( ...$allArgs ); # The interface for function hooks allows them to return a wikitext # string or an array containing the string and any flags. This mungs diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 9ec6cf82b27..265d1516a67 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -311,10 +311,10 @@ class ParserOutput extends CacheTime { } $skin = $wgOut->getSkin(); - return call_user_func_array( - [ $skin, 'doEditSectionLink' ], - [ $editsectionPage, $editsectionSection, - $editsectionContent, $wgLang->getCode() ] + return $skin->doEditSectionLink( $editsectionPage, + $editsectionSection, + $editsectionContent, + $wgLang->getCode() ); }, $text diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php index d41198ae553..3ceb915d276 100644 --- a/includes/resourceloader/ResourceLoaderContext.php +++ b/includes/resourceloader/ResourceLoaderContext.php @@ -226,7 +226,7 @@ class ResourceLoaderContext implements MessageLocalizer { * @return Message */ public function msg( $key ) { - return call_user_func_array( 'wfMessage', func_get_args() ) + return wfMessage( ...func_get_args() ) ->inLanguage( $this->getLanguage() ) // Use a dummy title because there is no real title // for this endpoint, and the cache won't vary on it diff --git a/includes/skins/BaseTemplate.php b/includes/skins/BaseTemplate.php index d1bea8d1b20..683877439e5 100644 --- a/includes/skins/BaseTemplate.php +++ b/includes/skins/BaseTemplate.php @@ -36,7 +36,7 @@ abstract class BaseTemplate extends QuickTemplate { * @return Message */ public function getMsg( $name /* ... */ ) { - return call_user_func_array( [ $this->getSkin(), 'msg' ], func_get_args() ); + return $this->getSkin()->msg( ...func_get_args() ); } function msg( $str ) { diff --git a/includes/specialpage/AuthManagerSpecialPage.php b/includes/specialpage/AuthManagerSpecialPage.php index 81e13f00f03..557bd9cc5ae 100644 --- a/includes/specialpage/AuthManagerSpecialPage.php +++ b/includes/specialpage/AuthManagerSpecialPage.php @@ -432,11 +432,11 @@ abstract class AuthManagerSpecialPage extends SpecialPage { $status = Status::newFatal( new RawMessage( '$1', $status ) ); } elseif ( is_array( $status ) ) { if ( is_string( reset( $status ) ) ) { - $status = call_user_func_array( 'Status::newFatal', $status ); + $status = Status::newFatal( ...$status ); } elseif ( is_array( reset( $status ) ) ) { $status = Status::newGood(); foreach ( $status as $message ) { - call_user_func_array( [ $status, 'fatal' ], $message ); + $status->fatal( ...$message ); } } else { throw new UnexpectedValueException( 'invalid HTMLForm::trySubmit() return value: ' diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index 0622584331c..831644ef2fa 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -704,9 +704,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { return; } - $knownParams = call_user_func_array( - [ $this->getRequest(), 'getValues' ], - array_keys( $this->getOptions()->getAllValues() ) + $knownParams = $this->getRequest()->getValues( + ...array_keys( $this->getOptions()->getAllValues() ) ); // HACK: Temporarily until we can properly define "sticky" filters and parameters, diff --git a/includes/specialpage/SpecialPage.php b/includes/specialpage/SpecialPage.php index 317aa0d7c84..5db8066228a 100644 --- a/includes/specialpage/SpecialPage.php +++ b/includes/specialpage/SpecialPage.php @@ -791,10 +791,7 @@ class SpecialPage implements MessageLocalizer { * @see wfMessage */ public function msg( $key /* $args */ ) { - $message = call_user_func_array( - [ $this->getContext(), 'msg' ], - func_get_args() - ); + $message = $this->getContext()->msg( ...func_get_args() ); // RequestContext passes context to wfMessage, and the language is set from // the context, but setting the language for Message class removes the // interface message status, which breaks for example usernameless gender diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index efe354a3465..bc632b1c0d6 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -553,7 +553,7 @@ class SpecialBlock extends FormSpecialPage { if ( !$status->isOK() ) { $errors = $status->getErrorsArray(); - return call_user_func_array( [ $form, 'msg' ], $errors[0] ); + return $form->msg( ...$errors[0] ); } else { return true; } diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 6a471ba573e..5352d95b8de 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -854,7 +854,7 @@ abstract class UploadBase { if ( !is_array( $error ) ) { $error = [ $error ]; } - return call_user_func_array( 'Status::newFatal', $error ); + return Status::newFatal( ...$error ); } $status = $this->getLocalFile()->upload( @@ -1063,7 +1063,7 @@ abstract class UploadBase { if ( !$isPartial ) { $error = $this->runUploadStashFileHook( $user ); if ( $error ) { - return call_user_func_array( 'Status::newFatal', $error ); + return Status::newFatal( ...$error ); } } try { diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index 68bcb9d9c74..ee6f250a766 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -210,7 +210,7 @@ class UploadFromChunks extends UploadFromFile { // override doStashFile() with completely different functionality in this class... $error = $this->runUploadStashFileHook( $this->user ); if ( $error ) { - call_user_func_array( [ $status, 'fatal' ], $error ); + $status->fatal( ...$error ); return $status; } try { @@ -422,9 +422,9 @@ class UploadChunkFileException extends MWException { class UploadChunkVerificationException extends MWException { public $msg; - public function __construct( $res ) { - $this->msg = call_user_func_array( 'wfMessage', $res ); - parent::__construct( call_user_func_array( 'wfMessage', $res ) + public function __construct( array $res ) { + $this->msg = wfMessage( ...$res ); + parent::__construct( wfMessage( ...$res ) ->inLanguage( 'en' )->useDatabase( false )->text() ); } } diff --git a/maintenance/backup.inc b/maintenance/backup.inc index 0fdd417fc39..21d9bb1639b 100644 --- a/maintenance/backup.inc +++ b/maintenance/backup.inc @@ -142,7 +142,7 @@ class BackupDumper extends Maintenance { require_once $file; } $register = [ $class, 'register' ]; - call_user_func_array( $register, [ $this ] ); + $register( $this ); } function execute() { diff --git a/maintenance/storage/recompressTracked.php b/maintenance/storage/recompressTracked.php index 49b8e0a69d6..271cbf3dd6e 100644 --- a/maintenance/storage/recompressTracked.php +++ b/maintenance/storage/recompressTracked.php @@ -226,7 +226,7 @@ class RecompressTracked { } $cmd .= ' --child' . ' --wiki ' . wfEscapeShellArg( wfWikiID() ) . - ' ' . call_user_func_array( 'wfEscapeShellArg', $this->destClusters ); + ' ' . wfEscapeShellArg( ...$this->destClusters ); $this->replicaPipes = $this->replicaProcs = []; for ( $i = 0; $i < $this->numProcs; $i++ ) { @@ -426,12 +426,12 @@ class RecompressTracked { $args = array_slice( $ids, 0, $this->orphanBatchSize ); $ids = array_slice( $ids, $this->orphanBatchSize ); array_unshift( $args, 'doOrphanList' ); - call_user_func_array( [ $this, 'dispatch' ], $args ); + $this->dispatch( ...$args ); } if ( count( $ids ) ) { $args = $ids; array_unshift( $args, 'doOrphanList' ); - call_user_func_array( [ $this, 'dispatch' ], $args ); + $this->dispatch( ...$args ); } $this->report( 'orphans', $i, $numOrphans );