Get rid of call_user_func(_array)(), part 3
Also cleaned up nearby code in a couple places. Change-Id: Ibf44ee7c0ceb739d7e79406e4ff39303c316e285
This commit is contained in:
parent
bfb35823d9
commit
1e680456b4
28 changed files with 76 additions and 87 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
] );
|
||||
|
|
|
|||
|
|
@ -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() ) {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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() );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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 ) {
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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 ]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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." );
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
Loading…
Reference in a new issue