Get rid of call_user_func(_array)(), part 3
authorMax Semenik <maxsem.wiki@gmail.com>
Sat, 9 Jun 2018 23:26:32 +0000 (16:26 -0700)
committerMaxSem <maxsem.wiki@gmail.com>
Sun, 10 Jun 2018 02:21:24 +0000 (02:21 +0000)
Also cleaned up nearby code in a couple places.

Change-Id: Ibf44ee7c0ceb739d7e79406e4ff39303c316e285

28 files changed:
includes/SiteConfiguration.php
includes/filerepo/RepoGroup.php
includes/htmlform/HTMLFormField.php
includes/installer/DatabaseUpdater.php
includes/libs/ArrayUtils.php
includes/libs/MemoizedCallable.php
includes/libs/StringUtils.php
includes/libs/filebackend/SwiftFileBackend.php
includes/libs/objectcache/CachedBagOStuff.php
includes/libs/objectcache/MultiWriteBagOStuff.php
includes/libs/objectcache/WANObjectCache.php
includes/libs/rdbms/database/DBConnRef.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabaseSqlite.php
includes/libs/rdbms/lbfactory/LBFactory.php
includes/libs/rdbms/lbfactory/LBFactoryMulti.php
includes/libs/rdbms/lbfactory/LBFactorySimple.php
includes/libs/rdbms/lbfactory/LBFactorySingle.php
includes/libs/rdbms/loadbalancer/LoadBalancer.php
includes/libs/redis/RedisConnRef.php
includes/media/BitmapHandler.php
includes/media/SvgHandler.php
includes/page/Article.php
includes/parser/ParserDiffTest.php
includes/poolcounter/PoolCounterWorkViaCallback.php
includes/services/ServiceContainer.php
includes/skins/BaseTemplate.php
tests/phpunit/mocks/MockMessageLocalizer.php

index 6bd179a..8e77956 100644 (file)
@@ -432,7 +432,7 @@ class SiteConfiguration {
                        return $default;
                }
 
-               $ret = call_user_func_array( $this->siteParamsCallback, [ $this, $wiki ] );
+               $ret = ( $this->siteParamsCallback )( $this, $wiki );
                # Validate the returned value
                if ( !is_array( $ret ) ) {
                        return $default;
@@ -606,7 +606,7 @@ class SiteConfiguration {
 
        public function loadFullData() {
                if ( $this->fullLoadCallback && !$this->fullLoadDone ) {
-                       call_user_func( $this->fullLoadCallback, $this );
+                       ( $this->fullLoadCallback )( $this );
                        $this->fullLoadDone = true;
                }
        }
index 0056181..7dd8b25 100644 (file)
@@ -372,8 +372,7 @@ class RepoGroup {
                        $this->initialiseRepos();
                }
                foreach ( $this->foreignRepos as $repo ) {
-                       $args = array_merge( [ $repo ], $params );
-                       if ( call_user_func_array( $callback, $args ) ) {
+                       if ( $callback( $repo, ...$params ) ) {
                                return true;
                        }
                }
index cd4d4b7..a701575 100644 (file)
@@ -81,12 +81,9 @@ abstract class HTMLFormField {
                $args = func_get_args();
 
                if ( $this->mParent ) {
-                       $callback = [ $this->mParent, 'msg' ];
-               } else {
-                       $callback = 'wfMessage';
+                       return $this->mParent->msg( ...$args );
                }
-
-               return call_user_func_array( $callback, $args );
+               return wfMessage( ...$args );
        }
 
        /**
@@ -315,7 +312,7 @@ abstract class HTMLFormField {
                }
 
                if ( isset( $this->mValidationCallback ) ) {
-                       return call_user_func( $this->mValidationCallback, $value, $alldata, $this->mParent );
+                       return ( $this->mValidationCallback )( $value, $alldata, $this->mParent );
                }
 
                return true;
@@ -323,7 +320,7 @@ abstract class HTMLFormField {
 
        public function filter( $value, $alldata ) {
                if ( isset( $this->mFilterCallback ) ) {
-                       $value = call_user_func( $this->mFilterCallback, $value, $alldata, $this->mParent );
+                       $value = ( $this->mFilterCallback )( $value, $alldata, $this->mParent );
                }
 
                return $value;
index 4fc04db..1cd76b9 100644 (file)
@@ -410,9 +410,9 @@ abstract class DatabaseUpdater {
 
                foreach ( $updates as $funcList ) {
                        $func = $funcList[0];
-                       $arg = $funcList[1];
+                       $args = $funcList[1];
                        $origParams = $funcList[2];
-                       call_user_func_array( $func, $arg );
+                       $func( ...$args );
                        flush();
                        $this->updatesSkipped[] = $origParams;
                }
@@ -479,7 +479,7 @@ abstract class DatabaseUpdater {
                        } elseif ( $passSelf ) {
                                array_unshift( $params, $this );
                        }
-                       $ret = call_user_func_array( $func, $params );
+                       $ret = $func( ...$params );
                        flush();
                        if ( $ret !== false ) {
                                $updatesDone[] = $origParams;
index 0413ea0..e238887 100644 (file)
@@ -120,8 +120,8 @@ class ArrayUtils {
                $max = $valueCount;
                do {
                        $mid = $min + ( ( $max - $min ) >> 1 );
-                       $item = call_user_func( $valueCallback, $mid );
-                       $comparison = call_user_func( $comparisonCallback, $target, $item );
+                       $item = $valueCallback( $mid );
+                       $comparison = $comparisonCallback( $target, $item );
                        if ( $comparison > 0 ) {
                                $min = $mid;
                        } elseif ( $comparison == 0 ) {
@@ -133,8 +133,8 @@ class ArrayUtils {
                } while ( $min < $max - 1 );
 
                if ( $min == 0 ) {
-                       $item = call_user_func( $valueCallback, $min );
-                       $comparison = call_user_func( $comparisonCallback, $target, $item );
+                       $item = $valueCallback( $min );
+                       $comparison = $comparisonCallback( $target, $item );
                        if ( $comparison < 0 ) {
                                // Before the first item
                                return false;
@@ -168,7 +168,7 @@ class ArrayUtils {
                                                $args[] = $array[$key];
                                        }
                                }
-                               $valueret = call_user_func_array( __METHOD__, $args );
+                               $valueret = self::arrayDiffAssocRecursive( ...$args );
                                if ( count( $valueret ) ) {
                                        $ret[$key] = $valueret;
                                }
index 14462f1..e9d1fc1 100644 (file)
@@ -123,7 +123,7 @@ class MemoizedCallable {
                $success = false;
                $result = $this->fetchResult( $key, $success );
                if ( !$success ) {
-                       $result = call_user_func_array( $this->callable, $args );
+                       $result = ( $this->callable )( ...$args );
                        $this->storeResult( $key, $result );
                }
 
index 7915ccf..d91ac85 100644 (file)
@@ -206,7 +206,7 @@ class StringUtils {
                        } elseif ( $tokenType == 'end' ) {
                                if ( $foundStart ) {
                                        # Found match
-                                       $output .= call_user_func( $callback, [
+                                       $output .= $callback( [
                                                substr( $subject, $outputPos, $tokenOffset + $tokenLength - $outputPos ),
                                                substr( $subject, $contentPos, $tokenOffset - $contentPos )
                                        ] );
index 3cd973e..2f7bc1e 100644 (file)
@@ -1103,7 +1103,7 @@ class SwiftFileBackend extends FileBackendStore {
 
                if ( empty( $params['allowOB'] ) ) {
                        // Cancel output buffering and gzipping if set
-                       call_user_func( $this->obResetFunc );
+                       ( $this->obResetFunc )();
                }
 
                $handle = fopen( 'php://output', 'wb' );
@@ -1317,7 +1317,7 @@ class SwiftFileBackend extends FileBackendStore {
                        foreach ( $httpReqs as $index => $httpReq ) {
                                // Run the callback for each request of this operation
                                $callback = $fileOpHandles[$index]->callback;
-                               call_user_func_array( $callback, [ $httpReq, $statuses[$index] ] );
+                               $callback( $httpReq, $statuses[$index] );
                                // On failure, abort all remaining requests for this operation
                                // (e.g. abort the DELETE request if the COPY request fails for a move)
                                if ( !$statuses[$index]->isOK() ) {
index ae434c1..dbab593 100644 (file)
@@ -87,11 +87,11 @@ class CachedBagOStuff extends HashBagOStuff {
        }
 
        public function makeKey( $class, $component = null ) {
-               return call_user_func_array( [ $this->backend, __FUNCTION__ ], func_get_args() );
+               return $this->backend->makeKey( ...func_get_args() );
        }
 
        public function makeGlobalKey( $class, $component = null ) {
-               return call_user_func_array( [ $this->backend, __FUNCTION__ ], func_get_args() );
+               return $this->backend->makeGlobalKey( ...func_get_args() );
        }
 
        // These just call the backend (tested elsewhere)
index b030522..edd5fbc 100644 (file)
@@ -195,16 +195,15 @@ class MultiWriteBagOStuff extends BagOStuff {
 
                        if ( $i == 0 || !$asyncWrites ) {
                                // First store or in sync mode: write now and get result
-                               if ( !call_user_func_array( [ $cache, $method ], $args ) ) {
+                               if ( !$cache->$method( ...$args ) ) {
                                        $ret = false;
                                }
                        } else {
                                // Secondary write in async mode: do not block this HTTP request
                                $logger = $this->logger;
-                               call_user_func(
-                                       $this->asyncHandler,
+                               ( $this->asyncHandler )(
                                        function () use ( $cache, $method, $args, $logger ) {
-                                               if ( !call_user_func_array( [ $cache, $method ], $args ) ) {
+                                               if ( !$cache->$method( ...$args ) ) {
                                                        $logger->warning( "Async $method op failed" );
                                                }
                                        }
@@ -235,10 +234,10 @@ class MultiWriteBagOStuff extends BagOStuff {
        }
 
        public function makeKey( $class, $component = null ) {
-               return call_user_func_array( [ $this->caches[0], __FUNCTION__ ], func_get_args() );
+               return $this->caches[0]->makeKey( ...func_get_args() );
        }
 
        public function makeGlobalKey( $class, $component = null ) {
-               return call_user_func_array( [ $this->caches[0], __FUNCTION__ ], func_get_args() );
+               return $this->caches[0]->makeGlobalKey( ...func_get_args() );
        }
 }
index 97e0456..927a1e3 100644 (file)
@@ -1603,7 +1603,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         * @since 1.27
         */
        public function makeKey( $class, $component = null ) {
-               return call_user_func_array( [ $this->cache, __FUNCTION__ ], func_get_args() );
+               return $this->cache->makeKey( ...func_get_args() );
        }
 
        /**
@@ -1614,7 +1614,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         * @since 1.27
         */
        public function makeGlobalKey( $class, $component = null ) {
-               return call_user_func_array( [ $this->cache, __FUNCTION__ ], func_get_args() );
+               return $this->cache->makeGlobalKey( ...func_get_args() );
        }
 
        /**
index dedf6ea..b414a2a 100644 (file)
@@ -46,7 +46,7 @@ class DBConnRef implements IDatabase {
                        $this->conn = $this->lb->getConnection( $db, $groups, $wiki, $flags );
                }
 
-               return call_user_func_array( [ $this->conn, $name ], $arguments );
+               return $this->conn->$name( ...$arguments );
        }
 
        public function getServerInfo() {
index 16e654f..57e5907 100644 (file)
@@ -1214,13 +1214,13 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
 
                $startTime = microtime( true );
                if ( $this->profiler ) {
-                       call_user_func( [ $this->profiler, 'profileIn' ], $queryProf );
+                       $this->profiler->profileIn( $queryProf );
                }
                $this->affectedRowCount = null;
                $ret = $this->doQuery( $commentedSql );
                $this->affectedRowCount = $this->affectedRows();
                if ( $this->profiler ) {
-                       call_user_func( [ $this->profiler, 'profileOut' ], $queryProf );
+                       $this->profiler->profileOut( $queryProf );
                }
                $queryRuntime = max( microtime( true ) - $startTime, 0.0 );
 
@@ -3230,7 +3230,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                $e = null;
                do {
                        try {
-                               $retVal = call_user_func_array( $function, $args );
+                               $retVal = $function( ...$args );
                                break;
                        } catch ( DBQueryError $e ) {
                                if ( $this->wasDeadlock() ) {
@@ -3310,7 +3310,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                        // No transaction is active nor will start implicitly, so make one for this callback
                        $this->startAtomic( __METHOD__, self::ATOMIC_CANCELABLE );
                        try {
-                               call_user_func( $callback, $this );
+                               $callback( $this );
                                $this->endAtomic( __METHOD__ );
                        } catch ( Exception $e ) {
                                $this->cancelAtomic( __METHOD__ );
@@ -3486,9 +3486,9 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                                try {
                                        ++$count;
                                        list( $phpCallback ) = $callback;
-                                       call_user_func( $phpCallback, $this );
+                                       $phpCallback( $this );
                                } catch ( Exception $ex ) {
-                                       call_user_func( $this->errorLogger, $ex );
+                                       $this->errorLogger( $ex );
                                        $e = $e ?: $ex;
                                }
                        }
@@ -3522,7 +3522,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                        try {
                                $phpCallback( $trigger, $this );
                        } catch ( Exception $ex ) {
-                               call_user_func( $this->errorLogger, $ex );
+                               ( $this->errorLogger )( $ex );
                                $e = $e ?: $ex;
                        }
                }
@@ -3723,7 +3723,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
        ) {
                $sectionId = $this->startAtomic( $fname, $cancelable );
                try {
-                       $res = call_user_func_array( $callback, [ $this, $fname ] );
+                       $res = $callback( $this, $fname );
                } catch ( Exception $e ) {
                        $this->cancelAtomic( $fname, $sectionId );
 
@@ -4249,7 +4249,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                                $cmd = $this->replaceVars( $cmd );
 
                                if ( $inputCallback ) {
-                                       $callbackResult = call_user_func( $inputCallback, $cmd );
+                                       $callbackResult = $inputCallback( $cmd );
 
                                        if ( is_string( $callbackResult ) || !$callbackResult ) {
                                                $cmd = $callbackResult;
@@ -4260,7 +4260,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                                        $res = $this->query( $cmd, $fname );
 
                                        if ( $resultCallback ) {
-                                               call_user_func( $resultCallback, $res, $this );
+                                               $resultCallback( $res, $this );
                                        }
 
                                        if ( false === $res ) {
index 2125c70..4b925e6 100644 (file)
@@ -865,7 +865,7 @@ class DatabaseSqlite extends Database {
                $args = func_get_args();
                $function = array_shift( $args );
 
-               return call_user_func_array( $function, $args );
+               return $function( ...$args );
        }
 
        /**
index 52c2df7..34436fb 100644 (file)
@@ -202,7 +202,7 @@ abstract class LBFactory implements ILBFactory {
        protected function forEachLBCallMethod( $methodName, array $args = [] ) {
                $this->forEachLB(
                        function ( ILoadBalancer $loadBalancer, $methodName, array $args ) {
-                               call_user_func_array( [ $loadBalancer, $methodName ], $args );
+                               $loadBalancer->$methodName( ...$args );
                        },
                        [ $methodName, $args ]
                );
index cfa2647..30074ec 100644 (file)
@@ -422,10 +422,10 @@ class LBFactoryMulti extends LBFactory {
         */
        public function forEachLB( $callback, array $params = [] ) {
                foreach ( $this->mainLBs as $lb ) {
-                       call_user_func_array( $callback, array_merge( [ $lb ], $params ) );
+                       $callback( $lb, ...$params );
                }
                foreach ( $this->extLBs as $lb ) {
-                       call_user_func_array( $callback, array_merge( [ $lb ], $params ) );
+                       $callback( $lb, ...$params );
                }
        }
 }
index 0d7b812..6a6bb8d 100644 (file)
@@ -149,10 +149,10 @@ class LBFactorySimple extends LBFactory {
         */
        public function forEachLB( $callback, array $params = [] ) {
                if ( isset( $this->mainLB ) ) {
-                       call_user_func_array( $callback, array_merge( [ $this->mainLB ], $params ) );
+                       $callback( $this->mainLB, ...$params );
                }
                foreach ( $this->extLBs as $lb ) {
-                       call_user_func_array( $callback, array_merge( [ $lb ], $params ) );
+                       $callback( $lb, ...$params );
                }
        }
 }
index 587ab23..2c1a782 100644 (file)
@@ -103,7 +103,7 @@ class LBFactorySingle extends LBFactory {
         */
        public function forEachLB( $callback, array $params = [] ) {
                if ( isset( $this->lb ) ) { // may not be set during _destruct()
-                       call_user_func_array( $callback, array_merge( [ $this->lb ], $params ) );
+                       $callback( $this->lb, ...$params );
                }
        }
 }
index 221bca4..6b271a7 100644 (file)
@@ -864,7 +864,7 @@ class LoadBalancer implements ILoadBalancer {
                        $this->connLogger->debug( __METHOD__ . ': calling initLB() before first connection.' );
                        // Load any "waitFor" positions before connecting so that doWait() is triggered
                        $this->connectionAttempted = true;
-                       call_user_func( $this->chronologyCallback, $this );
+                       ( $this->chronologyCallback )( $this );
                }
 
                // Check if an auto-commit connection is being requested. If so, it will not reuse the
@@ -1370,7 +1370,7 @@ class LoadBalancer implements ILoadBalancer {
                                try {
                                        $conn->commit( $fname, $conn::FLUSHING_ALL_PEERS );
                                } catch ( DBError $e ) {
-                                       call_user_func( $this->errorLogger, $e );
+                                       ( $this->errorLogger )( $e );
                                        $failures[] = "{$conn->getServer()}: {$e->getMessage()}";
                                }
                        }
@@ -1723,8 +1723,7 @@ class LoadBalancer implements ILoadBalancer {
                foreach ( $this->conns as $connsByServer ) {
                        foreach ( $connsByServer as $serverConns ) {
                                foreach ( $serverConns as $conn ) {
-                                       $mergedParams = array_merge( [ $conn ], $params );
-                                       call_user_func_array( $callback, $mergedParams );
+                                       $callback( $conn, ...$params );
                                }
                        }
                }
@@ -1736,8 +1735,7 @@ class LoadBalancer implements ILoadBalancer {
                        if ( isset( $connsByServer[$masterIndex] ) ) {
                                /** @var IDatabase $conn */
                                foreach ( $connsByServer[$masterIndex] as $conn ) {
-                                       $mergedParams = array_merge( [ $conn ], $params );
-                                       call_user_func_array( $callback, $mergedParams );
+                                       $callback( $conn, ...$params );
                                }
                        }
                }
@@ -1750,8 +1748,7 @@ class LoadBalancer implements ILoadBalancer {
                                        continue; // skip master
                                }
                                foreach ( $serverConns as $conn ) {
-                                       $mergedParams = array_merge( [ $conn ], $params );
-                                       call_user_func_array( $callback, $mergedParams );
+                                       $callback( $conn, ...$params );
                                }
                        }
                }
index ede35fa..bbcb267 100644 (file)
@@ -133,10 +133,10 @@ class RedisConnRef implements LoggerAwareInterface {
        private function tryCall( $method, $arguments ) {
                $this->conn->clearLastError();
                try {
-                       $res = call_user_func_array( [ $this->conn, $method ], $arguments );
+                       $res = $this->conn->$method( ...$arguments );
                        $authError = $this->checkAuthentication();
                        if ( $authError === self::AUTH_ERROR_TEMPORARY ) {
-                               $res = call_user_func_array( [ $this->conn, $method ], $arguments );
+                               $res = $this->conn->$method( ...$arguments );
                        }
                        if ( $authError === self::AUTH_ERROR_PERMANENT ) {
                                throw new RedisException( "Failure reauthenticating to Redis." );
index 4cb7c87..e2d32cf 100644 (file)
@@ -449,7 +449,7 @@ class BitmapHandler extends TransformationalImageHandler {
                        return $this->getMediaTransformError( $params, $errMsg );
                }
 
-               $src_image = call_user_func( $loader, $params['srcPath'] );
+               $src_image = $loader( $params['srcPath'] );
 
                $rotation = function_exists( 'imagerotate' ) && !isset( $params['disableRotation'] ) ?
                        $this->getRotation( $image ) :
@@ -489,7 +489,7 @@ class BitmapHandler extends TransformationalImageHandler {
                if ( $useQuality && isset( $params['quality'] ) ) {
                        $funcParams[] = $params['quality'];
                }
-               call_user_func_array( $saveType, $funcParams );
+               $saveType( ...$funcParams );
 
                imagedestroy( $dst_image );
                imagedestroy( $src_image );
index a589dbf..a9c7b4f 100644 (file)
@@ -291,12 +291,16 @@ class SvgHandler extends ImageHandler {
                        if ( is_array( $wgSVGConverters[$wgSVGConverter] ) ) {
                                // This is a PHP callable
                                $func = $wgSVGConverters[$wgSVGConverter][0];
-                               $args = array_merge( [ $srcPath, $dstPath, $width, $height, $lang ],
-                                       array_slice( $wgSVGConverters[$wgSVGConverter], 1 ) );
                                if ( !is_callable( $func ) ) {
                                        throw new MWException( "$func is not callable" );
                                }
-                               $err = call_user_func_array( $func, $args );
+                               $err = $func( $srcPath,
+                                       $dstPath,
+                                       $width,
+                                       $height,
+                                       $lang,
+                                       ...array_slice( $wgSVGConverters[$wgSVGConverter], 1 )
+                               );
                                $retval = (bool)$err;
                        } else {
                                // External command
index c865d4e..1abf974 100644 (file)
@@ -279,8 +279,8 @@ class Article implements Page {
                                if ( $this->mRevision !== null ) {
                                        // Revision title doesn't match the page title given?
                                        if ( $this->mPage->getId() != $this->mRevision->getPage() ) {
-                                               $function = [ get_class( $this->mPage ), 'newFromID' ];
-                                               $this->mPage = call_user_func( $function, $this->mRevision->getPage() );
+                                               $function = get_class( $this->mPage ). '::newFromID';
+                                               $this->mPage = $function( $this->mRevision->getPage() );
                                        }
                                }
                        }
index 353825a..93f4246 100644 (file)
@@ -61,12 +61,9 @@ class ParserDiffTest {
                $results = [];
                $mismatch = false;
                $lastResult = null;
-               $first = true;
-               foreach ( $this->parsers as $i => $parser ) {
-                       $currentResult = call_user_func_array( [ &$this->parsers[$i], $name ], $args );
-                       if ( $first ) {
-                               $first = false;
-                       } else {
+               foreach ( $this->parsers as $parser ) {
+                       $currentResult = $parser->$name( ...$args );
+                       if ( count( $results ) > 0 ) {
                                if ( is_object( $lastResult ) ) {
                                        if ( $lastResult != $currentResult ) {
                                                $mismatch = true;
@@ -77,7 +74,7 @@ class ParserDiffTest {
                                        }
                                }
                        }
-                       $results[$i] = $currentResult;
+                       $results[] = $currentResult;
                        $lastResult = $currentResult;
                }
                if ( $mismatch ) {
index 834b8b1..aed52d1 100644 (file)
@@ -66,26 +66,26 @@ class PoolCounterWorkViaCallback extends PoolCounterWork {
        }
 
        public function doWork() {
-               return call_user_func_array( $this->doWork, [] );
+               return ( $this->doWork )();
        }
 
        public function getCachedWork() {
                if ( $this->doCachedWork ) {
-                       return call_user_func_array( $this->doCachedWork, [] );
+                       return ( $this->doCachedWork )();
                }
                return false;
        }
 
        public function fallback() {
                if ( $this->fallback ) {
-                       return call_user_func_array( $this->fallback, [] );
+                       return ( $this->fallback )();
                }
                return false;
        }
 
        public function error( $status ) {
                if ( $this->error ) {
-                       return call_user_func_array( $this->error, [ $status ] );
+                       return ( $this->error )( $status );
                }
                return false;
        }
index 4c52693..c98b7da 100644 (file)
@@ -355,9 +355,8 @@ class ServiceContainer implements DestructibleService {
         */
        private function createService( $name ) {
                if ( isset( $this->serviceInstantiators[$name] ) ) {
-                       $service = call_user_func_array(
-                               $this->serviceInstantiators[$name],
-                               array_merge( [ $this ], $this->extraInstantiationParams )
+                       $service = ( $this->serviceInstantiators[$name] )(
+                               $this, ...$this->extraInstantiationParams
                        );
                        // NOTE: when adding more wiring logic here, make sure copyWiring() is kept in sync!
                } else {
index 6838774..c1c856d 100644 (file)
@@ -597,10 +597,7 @@ abstract class BaseTemplate extends QuickTemplate {
 
                if ( $option == 'flat' ) {
                        // fold footerlinks into a single array using a bit of trickery
-                       $validFooterLinks = call_user_func_array(
-                               'array_merge',
-                               array_values( $validFooterLinks )
-                       );
+                       $validFooterLinks = array_merge( ...array_values( $validFooterLinks ) );
                }
 
                return $validFooterLinks;
index 143a419..4d35930 100644 (file)
@@ -37,7 +37,7 @@ class MockMessageLocalizer implements MessageLocalizer {
                $args = func_get_args();
 
                /** @var Message $message */
-               $message = call_user_func_array( 'wfMessage', $args );
+               $message = wfMessage( ...$args );
 
                if ( $this->languageCode !== null ) {
                        $message->inLanguage( $this->languageCode );