Merge "Use short array destructuring instead of list()"

This commit is contained in:
jenkins-bot 2022-10-21 11:11:06 +00:00 committed by Gerrit Code Review
commit a85966542d
300 changed files with 730 additions and 730 deletions

View file

@ -188,7 +188,7 @@ function wfImageAuthMain() {
Hooks::runner()->onImgAuthModifyHeaders( $title->getTitleValue(), $headers );
// Stream the requested file
list( $headers, $options ) = HTTPFileStreamer::preprocessHeaders( $headers );
[ $headers, $options ] = HTTPFileStreamer::preprocessHeaders( $headers );
wfDebugLog( 'img_auth', "Streaming `" . $filename . "`." );
$repo->streamFileWithStatus( $filename, $headers, $options );
}

View file

@ -250,7 +250,7 @@ class ActorMigrationBase {
$fields = [];
$joins = [];
list( $text, $actor ) = $this->getFieldNames( $key );
[ $text, $actor ] = $this->getFieldNames( $key );
if ( $this->readStage === SCHEMA_COMPAT_READ_OLD ) {
$fields[$key] = $key;
@ -311,7 +311,7 @@ class ActorMigrationBase {
throw new InvalidArgumentException( "Must use getInsertValuesWithTempTable() for $key" );
}
list( $text, $actor ) = $this->getFieldNames( $key );
[ $text, $actor ] = $this->getFieldNames( $key );
$ret = [];
if ( $this->writeStage & SCHEMA_COMPAT_WRITE_OLD ) {
$ret[$key] = $user->getId();
@ -352,7 +352,7 @@ class ActorMigrationBase {
throw new InvalidArgumentException( "Must use getInsertValues() for $key" );
}
list( $text, $actor ) = $this->getFieldNames( $key );
[ $text, $actor ] = $this->getFieldNames( $key );
$ret = [];
$callback = null;
@ -475,7 +475,7 @@ class ActorMigrationBase {
}
}
list( $text, $actor ) = $this->getFieldNames( $key );
[ $text, $actor ] = $this->getFieldNames( $key );
// Combine data into conditions to be ORed together
if ( $this->readStage === SCHEMA_COMPAT_READ_NEW ) {

View file

@ -397,7 +397,7 @@ class CommentParser {
$trail = "";
}
$linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
list( $inside, $trail ) = Linker::splitTrail( $trail );
[ $inside, $trail ] = Linker::splitTrail( $trail );
$linkText = $text;
$linkTarget = Linker::normalizeSubpageLink( $selfLinkTarget, $match[1], $linkText );

View file

@ -566,7 +566,7 @@ class CommentStore {
throw new InvalidArgumentException( "Must use insertWithTempTable() for $key" );
}
list( $fields ) = $this->insertInternal( $dbw, $key, $comment, $data );
[ $fields ] = $this->insertInternal( $dbw, $key, $comment, $data );
return $fields;
}
@ -604,7 +604,7 @@ class CommentStore {
wfDeprecated( __METHOD__ . " for $key", static::TEMP_TABLES[$key]['deprecatedIn'] );
}
list( $fields, $callback ) = $this->insertInternal( $dbw, $key, $comment, $data );
[ $fields, $callback ] = $this->insertInternal( $dbw, $key, $comment, $data );
if ( !$callback ) {
$callback = static function () {
// Do nothing.

View file

@ -396,7 +396,7 @@ function wfCgiToArray( $query ) {
$key = $bit;
$value = '';
} else {
list( $key, $value ) = explode( '=', $bit );
[ $key, $value ] = explode( '=', $bit );
}
$key = urldecode( $key );
$value = urldecode( $value );

View file

@ -103,7 +103,7 @@ class HeaderCallback {
foreach ( $values as $value ) {
// Set-Cookie header format: <cookie-name>=<cookie-value>; <non-sensitive attributes>
$parts = explode( ';', $value );
list( $name, $value ) = explode( '=', $parts[0], 2 );
[ $name, $value ] = explode( '=', $parts[0], 2 );
if ( strlen( $value ) > 8 ) {
$value = substr( $value, 0, 8 ) . '...';
$parts[0] = "$name=$value";

View file

@ -246,7 +246,7 @@ class MagicWordArray {
// continue;
throw new MWException( __METHOD__ . ': bad parameter name' );
}
list( /* $synIndex */, $magicName ) = $parts;
[ /* $synIndex */, $magicName ] = $parts;
$paramValue = next( $m );
return [ $magicName, $paramValue ];
}
@ -319,7 +319,7 @@ class MagicWordArray {
throw new Exception( "preg_match_all error $error: $errorText" );
} elseif ( $res ) {
foreach ( $matches as $m ) {
list( $name, $param ) = $this->parseMatch( $m );
[ $name, $param ] = $this->parseMatch( $m );
$found[$name] = $param;
}
}
@ -355,7 +355,7 @@ class MagicWordArray {
$regexes = $this->getRegexStart();
foreach ( $regexes as $regex ) {
if ( preg_match( $regex, $text, $m ) ) {
list( $id, ) = $this->parseMatch( $m );
[ $id, ] = $this->parseMatch( $m );
if ( strlen( $m[0] ) >= strlen( $text ) ) {
$text = '';
} else {

View file

@ -128,7 +128,7 @@ class OrderedStreamingForkController extends ForkController {
while ( !feof( $this->input ) ) {
$line = trim( fgets( $this->input ) );
if ( $line ) {
list( $id, $data ) = json_decode( $line );
[ $id, $data ] = json_decode( $line );
$result = call_user_func( $this->workCallback, $data );
fwrite( $this->output, json_encode( [ $id, $result ] ) . "\n" );
}
@ -204,7 +204,7 @@ class OrderedStreamingForkController extends ForkController {
stream_select( $read, $write, $except, $timeout );
foreach ( $read as $socket ) {
$line = fgets( $socket );
list( $id, $data ) = json_decode( trim( $line ) );
[ $id, $data ] = json_decode( trim( $line ) );
$this->receive( (int)$id, $data );
$sockets[] = $socket;
$idx = array_search( $socket, $used );

View file

@ -83,7 +83,7 @@ class UserDef extends TypeDef {
}
public function validate( $name, $value, array $settings, array $options ) {
list( $type, $user ) = $this->processUser( $value );
[ $type, $user ] = $this->processUser( $value );
if ( !$user || !in_array( $type, $settings[self::PARAM_ALLOWED_USER_TYPES], true ) ) {
// Message used: paramvalidator-baduser

View file

@ -687,7 +687,7 @@ class PermissionManager {
} elseif ( $title->isSpecialPage() ) {
// If it's a special page, ditch the subpage bit and check again
$name = $title->getDBkey();
list( $name, /* $subpage */ ) =
[ $name, /* $subpage */ ] =
$this->specialPageFactory->resolveAlias( $name );
if ( $name ) {
$pure = SpecialPage::getTitleFor( $name )->getPrefixedText();
@ -750,7 +750,7 @@ class PermissionManager {
*/
private function isSameSpecialPage( $name, LinkTarget $page ): bool {
if ( $page->getNamespace() === NS_SPECIAL ) {
list( $thisName, /* $subpage */ ) =
[ $thisName, /* $subpage */ ] =
$this->specialPageFactory->resolveAlias( $page->getDBkey() );
if ( $name == $thisName ) {
return true;
@ -1087,7 +1087,7 @@ class PermissionManager {
// TODO: remove & rework upon further use of LinkTarget
$title = Title::newFromLinkTarget( $page );
if ( $rigor !== self::RIGOR_QUICK && !$title->isUserConfigPage() ) {
list( $cascadingSources, $restrictions ) = $this->restrictionStore->getCascadeProtectionSources( $title );
[ $cascadingSources, $restrictions ] = $this->restrictionStore->getCascadeProtectionSources( $title );
// Cascading protection depends on more than this page...
// Several cascading protected pages may include this page...
// Check each cascading level

View file

@ -290,7 +290,7 @@ class ProtectionForm {
return;
}
list( $cascadeSources, /* $restrictions */ ) =
[ $cascadeSources, /* $restrictions */ ] =
$this->restrictionStore->getCascadeProtectionSources( $this->mTitle );
if ( count( $cascadeSources ) > 0 ) {
$titles = '';

View file

@ -438,7 +438,7 @@ RLPAGEMODULES = {$pageModulesJson};
}
// Link/embed each set
foreach ( $moduleSets as list( $embed, $moduleSet ) ) {
foreach ( $moduleSets as [ $embed, $moduleSet ] ) {
$moduleSetNames = array_keys( $moduleSet );
$context->setModules( $moduleSetNames );
if ( $embed ) {

View file

@ -181,7 +181,7 @@ class FileModule extends Module {
$hasTemplates = false;
// localBasePath and remoteBasePath both have unbelievably long fallback chains
// and need to be handled separately.
list( $this->localBasePath, $this->remoteBasePath ) =
[ $this->localBasePath, $this->remoteBasePath ] =
self::extractBasePaths( $options, $localBasePath, $remoteBasePath );
// Extract, validate and normalise remaining options
@ -842,7 +842,7 @@ class FileModule extends Module {
// Add new file paths, remapping them to refer to our directories and not use settings
// from the module we're modifying, which come from the base definition.
list( $localBasePath, $remoteBasePath ) = self::extractBasePaths( $overrides );
[ $localBasePath, $remoteBasePath ] = self::extractBasePaths( $overrides );
foreach ( $paths as $path ) {
$styleFiles[] = new FilePath( $path, $localBasePath, $remoteBasePath );

View file

@ -98,13 +98,13 @@ trait OOUIModule {
$themePaths = self::$builtinThemePaths;
$themePaths += ExtensionRegistry::getInstance()->getAttribute( 'OOUIThemePaths' );
list( $defaultLocalBasePath, $defaultRemoteBasePath ) =
[ $defaultLocalBasePath, $defaultRemoteBasePath ] =
FileModule::extractBasePaths();
// Allow custom themes' paths to be relative to the skin/extension that defines them,
// like with ResourceModuleSkinStyles
foreach ( $themePaths as &$paths ) {
list( $localBasePath, $remoteBasePath ) =
[ $localBasePath, $remoteBasePath ] =
FileModule::extractBasePaths( $paths );
if ( $localBasePath !== $defaultLocalBasePath || $remoteBasePath !== $defaultRemoteBasePath ) {
foreach ( $paths as &$path ) {

View file

@ -397,7 +397,7 @@ class SkinModule extends LessVarFileModule {
// Bypass the current module paths so that these files are served from core,
// instead of the individual skin's module directory.
list( $defaultLocalBasePath, $defaultRemoteBasePath ) =
[ $defaultLocalBasePath, $defaultRemoteBasePath ] =
FileModule::extractBasePaths(
[],
null,

View file

@ -81,7 +81,7 @@ class SqlModuleDependencyStore extends DependencyStore {
$rows = [];
foreach ( $dataByEntity as $entity => $data ) {
list( $module, $variant ) = $this->getEntityNameComponents( $entity );
[ $module, $variant ] = $this->getEntityNameComponents( $entity );
if ( !is_array( $data[self::KEY_PATHS] ) ) {
throw new InvalidArgumentException( "Invalid entry for '$entity'" );
}
@ -127,7 +127,7 @@ class SqlModuleDependencyStore extends DependencyStore {
$dbw = $this->getPrimaryDB();
$disjunctionConds = [];
foreach ( (array)$entities as $entity ) {
list( $module, $variant ) = $this->getEntityNameComponents( $entity );
[ $module, $variant ] = $this->getEntityNameComponents( $entity );
$disjunctionConds[] = $dbw->makeList(
[ 'md_skin' => $variant, 'md_module' => $module ],
$dbw::LIST_AND
@ -151,7 +151,7 @@ class SqlModuleDependencyStore extends DependencyStore {
private function fetchDependencyBlobs( array $entities, IDatabase $db ) {
$modulesByVariant = [];
foreach ( $entities as $entity ) {
list( $module, $variant ) = $this->getEntityNameComponents( $entity );
[ $module, $variant ] = $this->getEntityNameComponents( $entity );
$modulesByVariant[$variant][] = $module;
}

View file

@ -111,10 +111,10 @@ class MediaFileHandler extends SimpleHandler {
* @return array response data
*/
private function getResponse( File $file ): array {
list( $maxWidth, $maxHeight ) = self::getImageLimitsFromOption(
[ $maxWidth, $maxHeight ] = self::getImageLimitsFromOption(
$this->getAuthority()->getUser(), 'imagesize'
);
list( $maxThumbWidth, $maxThumbHeight ) = self::getImageLimitsFromOption(
[ $maxThumbWidth, $maxThumbHeight ] = self::getImageLimitsFromOption(
$this->getAuthority()->getUser(), 'thumbsize'
);
$transforms = [

View file

@ -132,7 +132,7 @@ class MediaLinksHandler extends SimpleHandler {
}, $results );
$files = $this->repoGroup->findFiles( $findTitles );
list( $maxWidth, $maxHeight ) = self::getImageLimitsFromOption(
[ $maxWidth, $maxHeight ] = self::getImageLimitsFromOption(
$this->getAuthority()->getUser(),
'imagesize'
);

View file

@ -509,7 +509,7 @@ class PageHistoryCountHandler extends SimpleHandler {
RevisionRecord $fromRev = null,
RevisionRecord $toRev = null
) {
list( $fromRev, $toRev ) = $this->orderRevisions( $fromRev, $toRev );
[ $fromRev, $toRev ] = $this->orderRevisions( $fromRev, $toRev );
return $this->revisionStore->countAuthorsBetween( $pageId, $fromRev,
$toRev, $this->getAuthority(), self::COUNT_LIMITS['editors'] );
}
@ -606,7 +606,7 @@ class PageHistoryCountHandler extends SimpleHandler {
RevisionRecord $fromRev = null,
RevisionRecord $toRev = null
) {
list( $fromRev, $toRev ) = $this->orderRevisions( $fromRev, $toRev );
[ $fromRev, $toRev ] = $this->orderRevisions( $fromRev, $toRev );
return $this->revisionStore->countRevisionsBetween(
$pageId,
$fromRev,

View file

@ -160,7 +160,7 @@ class SearchHandler extends Handler {
if ( $results instanceof Status ) {
$status = $results;
if ( !$status->isOK() ) {
list( $error ) = $status->splitByErrorType();
[ $error ] = $status->splitByErrorType();
if ( $error->getErrors() ) { // Only throw for errors, suppress warnings (for now)
$errorMessages = $error->getMessage();
throw new LocalizedHttpException(

View file

@ -26,7 +26,7 @@ class HeaderContainer {
$this->headerNames = [];
foreach ( $headers as $name => $value ) {
$this->headerNames[ strtolower( $name ) ] = $name;
list( $valueParts, $valueLine ) = $this->convertToListAndString( $value );
[ $valueParts, $valueLine ] = $this->convertToListAndString( $value );
$this->headerLines[$name] = $valueLine;
$this->headerLists[$name] = $valueParts;
}
@ -69,7 +69,7 @@ class HeaderContainer {
* @param string|string[] $value
*/
public function setHeader( $name, $value ) {
list( $valueParts, $valueLine ) = $this->convertToListAndString( $value );
[ $valueParts, $valueLine ] = $this->convertToListAndString( $value );
$lowerName = strtolower( $name );
$origName = $this->headerNames[$lowerName] ?? null;
if ( $origName !== null ) {
@ -88,7 +88,7 @@ class HeaderContainer {
* @param string|string[] $value
*/
public function addHeader( $name, $value ) {
list( $valueParts, $valueLine ) = $this->convertToListAndString( $value );
[ $valueParts, $valueLine ] = $this->convertToListAndString( $value );
$lowerName = strtolower( $name );
$origName = $this->headerNames[$lowerName] ?? null;
if ( $origName === null ) {

View file

@ -145,7 +145,7 @@ class Validator {
}
// Get the content type
list( $ct ) = explode( ';', $request->getHeaderLine( 'Content-Type' ), 2 );
[ $ct ] = explode( ';', $request->getHeaderLine( 'Content-Type' ), 2 );
$ct = strtolower( trim( $ct ) );
if ( $ct === '' ) {
// No Content-Type was supplied. RFC 7231 § 3.1.1.5 allows this, but since it's probably a

View file

@ -263,7 +263,7 @@ class RevisionStore
* @return DBConnRef
*/
private function getDBConnectionRefForQueryFlags( $queryFlags ) {
list( $mode, ) = DBAccessObjectUtils::getDBOptions( $queryFlags );
[ $mode, ] = DBAccessObjectUtils::getDBOptions( $queryFlags );
return $this->getDBConnectionRef( $mode );
}
@ -772,7 +772,7 @@ class RevisionStore
) {
$revisionRow = $this->getBaseRevisionRow( $dbw, $rev, $parentId );
list( $commentFields, $commentCallback ) =
[ $commentFields, $commentCallback ] =
$this->commentStore->insertWithTempTable(
$dbw,
'rev_comment',
@ -780,7 +780,7 @@ class RevisionStore
);
$revisionRow += $commentFields;
list( $actorFields, $actorCallback ) =
[ $actorFields, $actorCallback ] =
$this->actorMigration->getInsertValuesWithTempTable(
$dbw,
'rev_user',
@ -1123,7 +1123,7 @@ class RevisionStore
* @return null|RecentChange
*/
public function getRecentChange( RevisionRecord $rev, $flags = 0 ) {
list( $dbType, ) = DBAccessObjectUtils::getDBOptions( $flags );
[ $dbType, ] = DBAccessObjectUtils::getDBOptions( $flags );
$rc = RecentChange::newFromConds(
[ 'rc_this_oldid' => $rev->getId( $this->wikiId ) ],
@ -1416,7 +1416,7 @@ class RevisionStore
private function loadSlotRecordsFromDb( $revId, $queryFlags, PageIdentity $page ): array {
$revQuery = $this->getSlotsQueryInfo( [ 'content' ] );
list( $dbMode, $dbOptions ) = DBAccessObjectUtils::getDBOptions( $queryFlags );
[ $dbMode, $dbOptions ] = DBAccessObjectUtils::getDBOptions( $queryFlags );
$db = $this->getDBConnectionRef( $dbMode );
$res = $db->select(
@ -2682,7 +2682,7 @@ class RevisionStore
return null;
}
list( $dbType, ) = DBAccessObjectUtils::getDBOptions( $flags );
[ $dbType, ] = DBAccessObjectUtils::getDBOptions( $flags );
$db = $this->getDBConnectionRef( $dbType, [ 'contributions' ] );
$ts = $rev->getTimestamp();

View file

@ -101,7 +101,7 @@ class RevisionStoreCacheRecord extends RevisionStoreRecord {
* @throws RevisionAccessException if the row could not be loaded
*/
private function loadFreshRow() {
list( $freshRevDeleted, $freshUser ) = call_user_func( $this->mCallback, $this->mId );
[ $freshRevDeleted, $freshUser ] = call_user_func( $this->mCallback, $this->mId );
// Set to null to ensure we do not make unnecessary queries for subsequent getter calls,
// and to allow the closure to be freed.

View file

@ -160,7 +160,7 @@ class EtcdSource implements CacheableSource {
$lastException = false;
foreach ( ( $this->resolver )() as $server ) {
list( $host, $port ) = $server;
[ $host, $port ] = $server;
try {
return $this->loadFromEtcdServer( $host, $port );

View file

@ -138,7 +138,7 @@ class Status extends StatusValue {
* @return Status[]
*/
public function splitByErrorType() {
list( $errorsOnlyStatus, $warningsOnlyStatus ) = parent::splitByErrorType();
[ $errorsOnlyStatus, $warningsOnlyStatus ] = parent::splitByErrorType();
// phan/phan#2133?
'@phan-var Status $errorsOnlyStatus';
'@phan-var Status $warningsOnlyStatus';

View file

@ -265,7 +265,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
$this->getCacheTTL(),
function ( $unused, &$ttl, &$setOpts ) use ( $blobAddress, $queryFlags, &$error ) {
// Ignore $setOpts; blobs are immutable and negatives are not cached
list( $result, $errors ) = $this->fetchBlobs( [ $blobAddress ], $queryFlags );
[ $result, $errors ] = $this->fetchBlobs( [ $blobAddress ], $queryFlags );
// No negative caching; negative hits on text rows may be due to corrupted replica DBs
$error = $errors[$blobAddress] ?? null;
return $result[$blobAddress];
@ -297,7 +297,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
// Caching behavior should be restored by reverting I94c6f9ba7b9caeeb as soon as
// the root cause of T235188 has been resolved.
list( $blobsByAddress, $errors ) = $this->fetchBlobs( $blobAddresses, $queryFlags );
[ $blobsByAddress, $errors ] = $this->fetchBlobs( $blobAddresses, $queryFlags );
$blobsByAddress = array_map( static function ( $blob ) {
return $blob === false ? null : $blob;
@ -328,7 +328,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
$errors = [];
foreach ( $blobAddresses as $blobAddress ) {
try {
list( $schema, $id ) = self::splitBlobAddress( $blobAddress );
[ $schema, $id ] = self::splitBlobAddress( $blobAddress );
} catch ( InvalidArgumentException $ex ) {
throw new BlobAccessException(
$ex->getMessage() . '. Use findBadBlobs.php to remedy.',
@ -372,7 +372,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
$queryFlags |= DBAccessObjectUtils::hasFlags( $queryFlags, self::READ_LATEST )
? self::READ_LATEST_IMMUTABLE
: 0;
list( $index, $options, $fallbackIndex, $fallbackOptions ) =
[ $index, $options, $fallbackIndex, $fallbackOptions ] =
DBAccessObjectUtils::getDBOptions( $queryFlags );
// Text data is immutable; check replica DBs first.
$dbConnection = $this->getDBConnection( $index );
@ -654,7 +654,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
* @return int|null
*/
public function getTextIdFromAddress( $address ) {
list( $schema, $id, ) = self::splitBlobAddress( $address );
[ $schema, $id, ] = self::splitBlobAddress( $address );
if ( $schema !== 'tt' ) {
return null;

View file

@ -3090,7 +3090,7 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
$linksMigration = MediaWikiServices::getInstance()->getLinksMigration();
if ( isset( $linksMigration::$mapping[$table] ) ) {
list( $blNamespace, $blTitle ) = $linksMigration->getTitleFields( $table );
[ $blNamespace, $blTitle ] = $linksMigration->getTitleFields( $table );
$linktargetQueryInfo = $linksMigration->getQueryInfo( $table );
$fields = $linktargetQueryInfo['fields'];
$tables = $linktargetQueryInfo['tables'];

View file

@ -53,7 +53,7 @@ class WikiMap {
$wgConf->loadFullData();
list( $major, $minor ) = $wgConf->siteFromDB( $wikiID );
[ $major, $minor ] = $wgConf->siteFromDB( $wikiID );
if ( $major === null ) {
return null;
}

View file

@ -344,9 +344,9 @@ class HistoryAction extends FormlessAction {
$dbr = wfGetDB( DB_REPLICA );
if ( $direction === self::DIR_PREV ) {
list( $dirs, $oper ) = [ "ASC", ">=" ];
[ $dirs, $oper ] = [ "ASC", ">=" ];
} else { /* $direction === self::DIR_NEXT */
list( $dirs, $oper ) = [ "DESC", "<=" ];
[ $dirs, $oper ] = [ "DESC", "<=" ];
}
if ( $offset ) {

View file

@ -501,7 +501,7 @@ class HistoryPager extends ReverseChronologicalPager {
}
# Tags
list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
[ $tagSummary, $newClasses ] = ChangeTags::formatSummaryRow(
$row->ts_tags,
'history',
$this->getContext()

View file

@ -804,7 +804,7 @@ abstract class ApiBase extends ContextSource {
// ApiSandbox.PageLayout.prototype.updateTemplatedParams().
// If you update this, see if that needs updating too.
while ( $toProcess ) {
list( $name, $targets, $settings ) = array_shift( $toProcess );
[ $name, $targets, $settings ] = array_shift( $toProcess );
foreach ( $targets as $placeholder => $target ) {
if ( !array_key_exists( $target, $results ) ) {
@ -1254,7 +1254,7 @@ abstract class ApiBase extends ContextSource {
$error = [ $error ];
}
if ( is_string( $error[0] ) && isset( self::$blockMsgMap[$error[0]] ) && $user->getBlock() ) {
list( $msg, $code ) = self::$blockMsgMap[$error[0]];
[ $msg, $code ] = self::$blockMsgMap[$error[0]];
$status->fatal( ApiMessage::create( $msg, $code,
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable Block is checked and not null
[ 'blockinfo' => $this->getBlockDetails( $user->getBlock() ) ]
@ -1282,7 +1282,7 @@ abstract class ApiBase extends ContextSource {
}
if ( $block ) {
foreach ( self::$blockMsgMap as $msg => list( $apiMsg, $code ) ) {
foreach ( self::$blockMsgMap as $msg => [ $apiMsg, $code ] ) {
if ( $status->hasMessage( $msg ) ) {
$status->replaceMessage( $msg, ApiMessage::create( $apiMsg, $code,
[ 'blockinfo' => $this->getBlockDetails( $block ) ]
@ -1325,7 +1325,7 @@ abstract class ApiBase extends ContextSource {
protected function filterIDs( $fields, array $ids ) {
$min = INF;
$max = 0;
foreach ( $fields as list( $table, $field ) ) {
foreach ( $fields as [ $table, $field ] ) {
if ( isset( self::$filterIDsCache[$table][$field] ) ) {
$row = self::$filterIDsCache[$table][$field];
} else {

View file

@ -135,7 +135,7 @@ class ApiBlock extends ApiBase {
$this->dieWithError( [ 'apierror-nosuchuserid', $params['userid'] ], 'nosuchuserid' );
}
}
list( $target, $targetType ) = $this->blockUtils->parseBlockTarget( $target );
[ $target, $targetType ] = $this->blockUtils->parseBlockTarget( $target );
if (
$params['noemail'] &&

View file

@ -97,7 +97,7 @@ class ApiComparePages extends ApiBase {
$this->getMain()->setCacheMode( 'public' );
// Get the 'from' RevisionRecord
list( $fromRev, $fromRelRev, $fromValsRev ) = $this->getDiffRevision( 'from', $params );
[ $fromRev, $fromRelRev, $fromValsRev ] = $this->getDiffRevision( 'from', $params );
// Get the 'to' RevisionRecord
if ( $params['torelative'] !== null ) {
@ -112,7 +112,7 @@ class ApiComparePages extends ApiBase {
switch ( $params['torelative'] ) {
case 'prev':
// Swap 'from' and 'to'
list( $toRev, $toRelRev, $toValsRev ) = [ $fromRev, $fromRelRev, $fromValsRev ];
[ $toRev, $toRelRev, $toValsRev ] = [ $fromRev, $fromRelRev, $fromValsRev ];
$fromRev = $this->revisionStore->getPreviousRevision( $toRelRev );
$fromRelRev = $fromRev;
$fromValsRev = $fromRev;
@ -171,7 +171,7 @@ class ApiComparePages extends ApiBase {
break;
}
} else {
list( $toRev, $toRelRev, $toValsRev ) = $this->getDiffRevision( 'to', $params );
[ $toRev, $toRelRev, $toValsRev ] = $this->getDiffRevision( 'to', $params );
}
// Handle missing from or to revisions (should never happen)

View file

@ -264,7 +264,7 @@ class ApiContinuationManager {
* @param ApiResult $result
*/
public function setContinuationIntoResult( ApiResult $result ) {
list( $data, $batchcomplete ) = $this->getContinuation();
[ $data, $batchcomplete ] = $this->getContinuation();
if ( $data ) {
$result->addValue( null, 'continue', $data,
ApiResult::ADD_ON_TOP | ApiResult::NO_SIZE_CHECK );

View file

@ -141,7 +141,7 @@ class ApiModuleManager extends ContextSource {
return null;
}
list( $moduleGroup, $spec ) = $this->mModules[$moduleName];
[ $moduleGroup, $spec ] = $this->mModules[$moduleName];
if ( $group !== null && $moduleGroup !== $group ) {
return null;

View file

@ -191,7 +191,7 @@ class ApiOpenSearch extends ApiBase {
$dbkey = $title->getDBkey();
$from = null;
if ( isset( $redirects[$ns][$dbkey] ) ) {
list( $ns, $dbkey ) = $redirects[$ns][$dbkey];
[ $ns, $dbkey ] = $redirects[$ns][$dbkey];
$from = $title;
$title = Title::makeTitle( $ns, $dbkey );
}

View file

@ -1429,7 +1429,7 @@ class ApiPageSet extends ApiBase {
$context->setTitle( $titleObj );
$context->setRequest( new FauxRequest );
$special->setContext( $context );
list( /* $alias */, $subpage ) = $this->specialPageFactory->resolveAlias( $dbkey );
[ /* $alias */, $subpage ] = $this->specialPageFactory->resolveAlias( $dbkey );
$target = $special->getRedirect( $subpage );
}
}

View file

@ -252,7 +252,7 @@ class ApiParse extends ApiBase {
$titleObj = Title::newFromLinkTarget( $revLinkTarget );
$wgTitle = $titleObj;
$pageObj = $this->wikiPageFactory->newFromTitle( $titleObj );
list( $popts, $reset, $suppressCache ) = $this->makeParserOptions( $pageObj, $params );
[ $popts, $reset, $suppressCache ] = $this->makeParserOptions( $pageObj, $params );
$p_result = $this->getParsedContent(
$pageObj, $popts, $suppressCache, $pageid, $rev, $needContent
);
@ -297,7 +297,7 @@ class ApiParse extends ApiBase {
$oldid = $pageObj->getLatest();
}
list( $popts, $reset, $suppressCache ) = $this->makeParserOptions( $pageObj, $params );
[ $popts, $reset, $suppressCache ] = $this->makeParserOptions( $pageObj, $params );
$p_result = $this->getParsedContent(
$pageObj, $popts, $suppressCache, $pageid, null, $needContent
);
@ -332,12 +332,12 @@ class ApiParse extends ApiBase {
$wgTitle = $titleObj;
if ( $titleObj->canExist() ) {
$pageObj = $this->wikiPageFactory->newFromTitle( $titleObj );
list( $popts, $reset ) = $this->makeParserOptions( $pageObj, $params );
[ $popts, $reset ] = $this->makeParserOptions( $pageObj, $params );
} else { // A special page, presumably
// XXX: Why is this needed at all? Can't we just fail?
$pageObj = null;
$popts = ParserOptions::newCanonical( $this->getContext() );
list( $popts, $reset ) = $this->tweakParserOptions( $popts, $titleObj, $params );
[ $popts, $reset ] = $this->tweakParserOptions( $popts, $titleObj, $params );
}
$textProvided = $text !== null;

View file

@ -260,7 +260,7 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
$mimeConds = [];
foreach ( $params['mime'] as $mime ) {
list( $major, $minor ) = File::splitMime( $mime );
[ $major, $minor ] = File::splitMime( $mime );
$mimeConds[] = $db->makeList(
[
'img_major_mime' => $major,

View file

@ -132,7 +132,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
$nsField = $pfx . 'namespace';
$titleField = $pfx . $this->fieldTitle;
if ( isset( $this->linksMigration::$mapping[$this->table] ) ) {
list( $nsField, $titleField ) = $this->linksMigration->getTitleFields( $this->table );
[ $nsField, $titleField ] = $this->linksMigration->getTitleFields( $this->table );
$queryInfo = $this->linksMigration->getQueryInfo( $this->table );
$this->addTables( $queryInfo['tables'] );
$this->addJoinConds( $queryInfo['joins'] );

View file

@ -102,7 +102,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
$this->hasNS = $moduleName !== 'imageusage';
$this->linksMigration = $linksMigration;
if ( isset( $this->linksMigration::$mapping[$this->bl_table] ) ) {
list( $this->bl_ns, $this->bl_title ) = $this->linksMigration->getTitleFields( $this->bl_table );
[ $this->bl_ns, $this->bl_title ] = $this->linksMigration->getTitleFields( $this->bl_table );
} else {
$this->bl_ns = $prefix . '_namespace';
if ( $this->hasNS ) {

View file

@ -131,7 +131,7 @@ class ApiQueryBacklinksprop extends ApiQueryGeneratorBase {
$hasNS = !isset( $settings['to_namespace'] );
if ( $hasNS ) {
if ( isset( $this->linksMigration::$mapping[$settings['linktable']] ) ) {
list( $bl_namespace, $bl_title ) = $this->linksMigration->getTitleFields( $settings['linktable'] );
[ $bl_namespace, $bl_title ] = $this->linksMigration->getTitleFields( $settings['linktable'] );
} else {
$bl_namespace = "{$p}_namespace";
$bl_title = "{$p}_title";
@ -224,7 +224,7 @@ class ApiQueryBacklinksprop extends ApiQueryGeneratorBase {
}
// Populate the rest of the query
list( $idxNoFromNS, $idxWithFromNS ) = $settings['indexes'] ?? [ '', '' ];
[ $idxNoFromNS, $idxWithFromNS ] = $settings['indexes'] ?? [ '', '' ];
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset False positive
if ( isset( $this->linksMigration::$mapping[$settings['linktable']] ) ) {
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset False positive

View file

@ -150,13 +150,13 @@ class ApiQueryBlocks extends ApiQueryBase {
}
# Check range validity, if it's a CIDR
list( $ip, $range ) = IPUtils::parseCIDR( $params['ip'] );
[ $ip, $range ] = IPUtils::parseCIDR( $params['ip'] );
if ( $ip !== false && $range !== false && $range < $cidrLimit ) {
$this->dieWithError( [ 'apierror-cidrtoobroad', $type, $cidrLimit ] );
}
# Let IPUtils::parseRange handle calculating $upper, instead of duplicating the logic here.
list( $lower, $upper ) = IPUtils::parseRange( $params['ip'] );
[ $lower, $upper ] = IPUtils::parseRange( $params['ip'] );
# Extract the common prefix to any rangeblock affecting this IP/CIDR
$prefix = substr( $lower, 0, $prefixLen + (int)floor( $cidrLimit / 4 ) );

View file

@ -578,7 +578,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
}
if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
list( , $mime ) = $file->getHandler()->getThumbType(
[ , $mime ] = $file->getHandler()->getThumbType(
$mto->getExtension(), $file->getMimeType(), $thumbParams );
$vals['thumbmime'] = $mime;
}

View file

@ -493,7 +493,7 @@ class ApiQueryInfo extends ApiQueryBase {
array_values( $this->restrictionStore->listApplicableRestrictionTypes( $title ) );
}
list( $blNamespace, $blTitle ) = $this->linksMigration->getTitleFields( 'templatelinks' );
[ $blNamespace, $blTitle ] = $this->linksMigration->getTitleFields( 'templatelinks' );
$queryInfo = $this->linksMigration->getQueryInfo( 'templatelinks' );
if ( count( $others ) ) {

View file

@ -102,7 +102,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
$params = $this->extractRequestParams();
if ( isset( $this->linksMigration::$mapping[$this->table] ) ) {
list( $nsField, $titleField ) = $this->linksMigration->getTitleFields( $this->table );
[ $nsField, $titleField ] = $this->linksMigration->getTitleFields( $this->table );
$queryInfo = $this->linksMigration->getQueryInfo( $this->table );
$this->addTables( $queryInfo['tables'] );
$this->addJoinConds( $queryInfo['joins'] );

View file

@ -162,7 +162,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
$valid = false;
} else {
$logActions = array_fill_keys( $this->getAllowedLogActions(), true );
list( $type, $action ) = explode( '/', $logAction, 2 );
[ $type, $action ] = explode( '/', $logAction, 2 );
$valid = isset( $logActions[$logAction] ) || isset( $logActions[$type . '/*'] );
}

View file

@ -164,14 +164,14 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
);
}
list( $left, $continue ) =
[ $left, $continue ] =
$this->runQuery( $resultPageSet, $params['limit'], $start, $startId, $end );
if ( $end === null && $continue === null ) {
// Wrap around. We do this even if $left === 0 for continuation
// (saving a DB query in this rare case probably isn't worth the
// added code complexity it would require).
$end = $rand;
list( $left, $continue ) = $this->runQuery( $resultPageSet, $left, null, null, $end );
[ $left, $continue ] = $this->runQuery( $resultPageSet, $left, null, null, $end );
}
if ( $continue !== null ) {

View file

@ -579,7 +579,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
];
}
} else {
list( , $lag, $index ) = $this->loadBalancer->getMaxLag();
[ , $lag, $index ] = $this->loadBalancer->getMaxLag();
$data[] = [
'host' => $showHostnames
? $this->loadBalancer->getServerName( $index )

View file

@ -228,7 +228,7 @@ class ApiQueryUserContribs extends ApiQueryBase {
// Because 'iprange' might produce a huge number of ips, use a
// generator with batched lookup and continuation.
$userIter = call_user_func( function () use ( $dbSecondary, $sort, $op, $fname, $ipRange ) {
list( $start, $end ) = IPUtils::parseRange( $ipRange );
[ $start, $end ] = IPUtils::parseRange( $ipRange );
if ( $this->params['continue'] !== null ) {
$continue = explode( '|', $this->params['continue'] );
$this->dieContinueUsageIf( count( $continue ) != 4 );

View file

@ -215,7 +215,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
$this->contentLanguage->needsGenderDistinction()
) {
$usernames = [];
foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
foreach ( $items as [ $watchedItem, $recentChangeInfo ] ) {
/** @var WatchedItem $watchedItem */
$linkTarget = $watchedItem->getTarget();
if ( $this->namespaceInfo->hasGenderDistinction( $linkTarget->getNamespace() ) ) {
@ -227,7 +227,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
}
}
foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
foreach ( $items as [ $watchedItem, $recentChangeInfo ] ) {
/** @var WatchedItem $watchedItem */
if ( $resultPageSet === null ) {
$vals = $this->extractOutputData( $watchedItem, $recentChangeInfo );

View file

@ -389,7 +389,7 @@ class ApiUpload extends ApiBase {
if ( $status->getMessage()->getKey() === 'uploadstash-exception' ) {
// The exceptions thrown by upload stash code and pretty silly and UploadBase returns poor
// Statuses for it. Just extract the exception details and parse them ourselves.
list( $exceptionType, $message ) = $status->getMessage()->getParams();
[ $exceptionType, $message ] = $status->getMessage()->getParams();
$debugMessage = 'Stashing temporary file failed: ' . $exceptionType . ' ' . $message;
wfDebug( __METHOD__ . ' ' . $debugMessage );
}

View file

@ -121,7 +121,7 @@ class ApiUserrights extends ApiBase {
$r = [];
$r['user'] = $user->getName();
$r['userid'] = $user->getId();
list( $r['added'], $r['removed'] ) = $form->doSaveUserGroups(
[ $r['added'], $r['removed'] ] = $form->doSaveUserGroups(
// Don't pass null to doSaveUserGroups() for array params, cast to empty array
$user, $add, (array)$params['remove'],
$params['reason'], (array)$tags, $groupExpiries

View file

@ -133,7 +133,7 @@ class ConfirmLinkSecondaryAuthenticationProvider extends AbstractSecondaryAuthen
$combinedStatus = \Status::newGood();
foreach ( $statuses as $data ) {
list( $req, $status ) = $data;
[ $req, $status ] = $data;
$descriptionInfo = $req->describeCredentials();
$description = wfMessage(
'authprovider-confirmlink-option',

View file

@ -203,7 +203,7 @@ class LocalPasswordPrimaryAuthenticationProvider
return false;
}
list( $db, $options ) = \DBAccessObjectUtils::getDBOptions( $flags );
[ $db, $options ] = \DBAccessObjectUtils::getDBOptions( $flags );
return (bool)$this->loadBalancer->getConnectionRef( $db )->selectField(
[ 'user' ],
'user_id',

View file

@ -233,7 +233,7 @@ class TemporaryPasswordPrimaryAuthenticationProvider
return false;
}
list( $db, $options ) = \DBAccessObjectUtils::getDBOptions( $flags );
[ $db, $options ] = \DBAccessObjectUtils::getDBOptions( $flags );
return (bool)$this->loadBalancer->getConnectionRef( $db )->selectField(
[ 'user' ],
'user_id',

View file

@ -400,7 +400,7 @@ abstract class AbstractBlock implements Block {
$this->target = null;
$this->type = null;
} else {
list( $parsedTarget, $this->type ) = MediaWikiServices::getInstance()
[ $parsedTarget, $this->type ] = MediaWikiServices::getInstance()
->getBlockUtils()
->parseBlockTarget( $target );
if ( $parsedTarget !== null ) {

View file

@ -76,7 +76,7 @@ class BlockPermissionChecker {
) {
$options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
$this->options = $options;
list( $this->target, $this->targetType ) = $blockUtils->parseBlockTarget( $target );
[ $this->target, $this->targetType ] = $blockUtils->parseBlockTarget( $target );
$this->performer = $performer;
}

View file

@ -243,7 +243,7 @@ class BlockUser {
$this->blockActionInfo = $blockActionInfo;
// Process block target
list( $this->target, $rawTargetType ) = $this->blockUtils->parseBlockTarget( $target );
[ $this->target, $rawTargetType ] = $this->blockUtils->parseBlockTarget( $target );
if ( $rawTargetType !== null ) { // Guard against invalid targets
$this->targetType = $rawTargetType;
} else {

View file

@ -154,7 +154,7 @@ class BlockUtils {
* @return Status
*/
public function validateTarget( $value ): Status {
list( $target, $type ) = $this->parseBlockTarget( $value );
[ $target, $type ] = $this->parseBlockTarget( $value );
$status = Status::newGood( $target );
@ -169,7 +169,7 @@ class BlockUtils {
break;
case AbstractBlock::TYPE_RANGE:
list( $ip, $range ) = explode( '/', $target, 2 );
[ $ip, $range ] = explode( '/', $target, 2 );
if ( IPUtils::isIPv4( $ip ) ) {
$status->merge( $this->validateIPv4Range( (int)$range ) );

View file

@ -251,7 +251,7 @@ class DatabaseBlock extends AbstractBlock {
# Be aware that the != '' check is explicit, since empty values will be
# passed by some callers (T31116)
if ( $vagueTarget != '' ) {
list( $target, $type ) = MediaWikiServices::getInstance()
[ $target, $type ] = MediaWikiServices::getInstance()
->getBlockUtils()
->parseBlockTarget( $vagueTarget );
switch ( $type ) {
@ -269,7 +269,7 @@ class DatabaseBlock extends AbstractBlock {
break;
case self::TYPE_RANGE:
list( $start, $end ) = IPUtils::parseRange( $target );
[ $start, $end ] = IPUtils::parseRange( $target );
$conds['ipb_address'][] = (string)$target;
$conds[] = self::getRangeCond( $start, $end );
$conds = $db->makeList( $conds, LIST_OR );
@ -352,7 +352,7 @@ class DatabaseBlock extends AbstractBlock {
# or take some floating point errors
$target = $block->getTargetName();
$max = IPUtils::isIPv6( $target ) ? 128 : 32;
list( $network, $bits ) = IPUtils::parseCIDR( $target );
[ $network, $bits ] = IPUtils::parseCIDR( $target );
$size = $max - $bits;
# Rank a range block covering a single IP equally with a single-IP block
@ -689,7 +689,7 @@ class DatabaseBlock extends AbstractBlock {
case self::TYPE_IP:
return IPUtils::toHex( $this->target );
case self::TYPE_RANGE:
list( $start, /*...*/ ) = IPUtils::parseRange( $this->target );
[ $start, /*...*/ ] = IPUtils::parseRange( $this->target );
return $start;
default:
throw new MWException( "Block with invalid type" );
@ -708,7 +708,7 @@ class DatabaseBlock extends AbstractBlock {
case self::TYPE_IP:
return IPUtils::toHex( $this->target );
case self::TYPE_RANGE:
list( /*...*/, $end ) = IPUtils::parseRange( $this->target );
[ /*...*/, $end ] = IPUtils::parseRange( $this->target );
return $end;
default:
throw new MWException( "Block with invalid type" );
@ -868,7 +868,7 @@ class DatabaseBlock extends AbstractBlock {
$vagueTarget = null,
$fromPrimary = false
) {
list( $target, $type ) = MediaWikiServices::getInstance()
[ $target, $type ] = MediaWikiServices::getInstance()
->getBlockUtils()
->parseBlockTarget( $specificTarget );
if ( $type == self::TYPE_ID || $type == self::TYPE_AUTO ) {

View file

@ -105,7 +105,7 @@ class UnblockUser {
$this->hookRunner = new HookRunner( $hookContainer );
// Process params
list( $this->target, $this->targetType ) = $this->blockUtils->parseBlockTarget( $target );
[ $this->target, $this->targetType ] = $this->blockUtils->parseBlockTarget( $target );
if (
$this->targetType === AbstractBlock::TYPE_AUTO &&
is_numeric( $this->target )

View file

@ -480,7 +480,7 @@ class BacklinkCache {
$cacheEntry['numRows'] += $partitions['numRows'];
$cacheEntry['batches'] = array_merge( $cacheEntry['batches'], $partitions['batches'] );
if ( count( $partitions['batches'] ) ) {
list( , $lEnd ) = end( $partitions['batches'] );
[ , $lEnd ] = end( $partitions['batches'] );
$start = $lEnd + 1; // pick up after this inclusive range
}
} while ( $partitions['numRows'] >= $selectSize );

View file

@ -375,7 +375,7 @@ class LinkBatch {
*/
public function constructSet( $prefix, $db ) {
if ( isset( $this->linksMigration::$prefixToTableMapping[$prefix] ) ) {
list( $blNamespace, $blTitle ) = $this->linksMigration->getTitleFields(
[ $blNamespace, $blTitle ] = $this->linksMigration->getTitleFields(
$this->linksMigration::$prefixToTableMapping[$prefix]
);
} else {

View file

@ -877,7 +877,7 @@ class ChangesList extends ContextSource {
return;
}
list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
[ $tagSummary, $newClasses ] = ChangeTags::formatSummaryRow(
$rc->mAttribs['ts_tags'],
'changeslist',
$this->getContext()

View file

@ -95,7 +95,7 @@ class OldChangesList extends ChangesList {
}
// Log entries (old format) or log targets, and special pages
} elseif ( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
list( $name, $htmlubpage ) = MediaWikiServices::getInstance()->getSpecialPageFactory()->
[ $name, $htmlubpage ] = MediaWikiServices::getInstance()->getSpecialPageFactory()->
resolveAlias( $rc->mAttribs['rc_title'] );
if ( $name == 'Log' ) {
$this->insertLog( $html, $rc->getTitle(), $htmlubpage, false );

View file

@ -822,7 +822,7 @@ class ChangeTags {
}
// do it!
list( $tagsAdded, $tagsRemoved, $initialTags ) = self::updateTags( $tagsToAdd,
[ $tagsAdded, $tagsRemoved, $initialTags ] = self::updateTags( $tagsToAdd,
$tagsToRemove, $rc_id, $rev_id, $log_id, $params, null, $user );
if ( !$tagsAdded && !$tagsRemoved ) {
// no-op, don't log it

View file

@ -100,7 +100,7 @@ class ChangeTagsLogItem extends RevisionItemBase {
$attribs = [];
$tags = $this->getTags();
if ( $tags ) {
list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow(
[ $tagSummary, $classes ] = ChangeTags::formatSummaryRow(
$tags,
'edittags',
$this->list->getContext()

View file

@ -50,7 +50,7 @@ class ChangeTagsRevisionItem extends RevisionItem {
$attribs = [];
$tags = $this->getTags();
if ( $tags ) {
list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow(
[ $tagSummary, $classes ] = ChangeTags::formatSummaryRow(
$tags,
'edittags',
$this->list->getContext()

View file

@ -240,7 +240,7 @@ class EtcdConfig implements Config, LoggerAwareInterface {
$servers = $this->dsd->getServers() ?: [ [ $this->host, $this->port ] ];
foreach ( $servers as $server ) {
list( $host, $port ) = $server;
[ $host, $port ] = $server;
// Try to load the config from this particular server
$response = $this->fetchAllFromEtcdServer( $host, $port );
@ -265,7 +265,7 @@ class EtcdConfig implements Config, LoggerAwareInterface {
}
// Retrieve all the values under the MediaWiki config directory
list( $rcode, $rdesc, /* $rhdrs */, $rbody, $rerr ) = $this->http->run( [
[ $rcode, $rdesc, /* $rhdrs */, $rbody, $rerr ] = $this->http->run( [
'method' => 'GET',
'url' => "{$this->protocol}://{$host}/v2/keys/{$this->directory}/?recursive=true",
'headers' => [

View file

@ -718,7 +718,7 @@ abstract class ContentHandler {
if ( $title->inNamespace( NS_MEDIAWIKI ) ) {
// Parse mediawiki messages with correct target language
list( /* $unused */, $lang ) = $services->getMessageCache()->figureMessage( $title->getText() );
[ /* $unused */, $lang ] = $services->getMessageCache()->figureMessage( $title->getText() );
$pageLang = $services->getLanguageFactory()->getLanguage( $lang );
}

View file

@ -188,7 +188,7 @@ class WikitextContent extends TextContent {
* @see Content::getRedirectTarget
*/
public function getRedirectTarget() {
list( $title, ) = $this->getRedirectTargetAndText();
[ $title, ] = $this->getRedirectTargetAndText();
return $title;
}

View file

@ -295,7 +295,7 @@ class WikitextContentHandler extends TextContentHandler {
$parserOptions = $cpoParams->getParserOptions();
$revId = $cpoParams->getRevId();
list( $redir, $text ) = $content->getRedirectTargetAndText();
[ $redir, $text ] = $content->getRedirectTargetAndText();
$parserOutput = $services->getParserFactory()->getInstance()
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable castFrom does not return null here
->parse( $text, $title, $parserOptions, true, true, $revId );

View file

@ -161,7 +161,7 @@ trait DeprecationHelper {
// but to correctly support null coalescing for dynamic properties,
// e.g. $foo->bar ?? 'default'
if ( isset( $this->deprecatedPublicProperties[$name] ) ) {
list( $version, $class, $component, $getter ) = $this->deprecatedPublicProperties[$name];
[ $version, $class, $component, $getter ] = $this->deprecatedPublicProperties[$name];
$qualifiedName = $class . '::$' . $name;
wfDeprecated( $qualifiedName, $version, $component, 2 );
if ( $getter ) {
@ -186,7 +186,7 @@ trait DeprecationHelper {
public function __get( $name ) {
if ( isset( $this->deprecatedPublicProperties[$name] ) ) {
list( $version, $class, $component, $getter ) = $this->deprecatedPublicProperties[$name];
[ $version, $class, $component, $getter ] = $this->deprecatedPublicProperties[$name];
$qualifiedName = $class . '::$' . $name;
wfDeprecated( $qualifiedName, $version, $component, 2 );
if ( $getter ) {
@ -215,7 +215,7 @@ trait DeprecationHelper {
public function __set( $name, $value ) {
if ( isset( $this->deprecatedPublicProperties[$name] ) ) {
list( $version, $class, $component, , $setter ) = $this->deprecatedPublicProperties[$name];
[ $version, $class, $component, , $setter ] = $this->deprecatedPublicProperties[$name];
$qualifiedName = $class . '::$' . $name;
wfDeprecated( $qualifiedName, $version, $component, 2 );
if ( $setter ) {

View file

@ -169,7 +169,7 @@ class CdnCacheUpdate implements DeferrableUpdate, MergeableUpdate {
// Avoid multiple queries for HtmlCacheUpdater::getUrls() call
$lb = $services->getLinkBatchFactory()->newLinkBatch();
foreach ( $this->pageTuples as list( $page, $delay ) ) {
foreach ( $this->pageTuples as [ $page, $delay ] ) {
$lb->addObj( $page );
}
$lb->execute();
@ -178,14 +178,14 @@ class CdnCacheUpdate implements DeferrableUpdate, MergeableUpdate {
// Resolve the titles into CDN URLs
$htmlCacheUpdater = $services->getHtmlCacheUpdater();
foreach ( $this->pageTuples as list( $page, $delay ) ) {
foreach ( $this->pageTuples as [ $page, $delay ] ) {
foreach ( $htmlCacheUpdater->getUrls( $page ) as $url ) {
// Use the highest rebound for duplicate URLs in order to handle the most lag
$reboundDelayByUrl[$url] = max( $reboundDelayByUrl[$url] ?? 0, $delay );
}
}
foreach ( $this->urlTuples as list( $url, $delay ) ) {
foreach ( $this->urlTuples as [ $url, $delay ] ) {
// Use the highest rebound for duplicate URLs in order to handle the most lag
$reboundDelayByUrl[$url] = max( $reboundDelayByUrl[$url] ?? 0, $delay );
}

View file

@ -149,7 +149,7 @@ class LinksUpdate extends DataUpdate {
$ill = $this->getParserOutput()->getLanguageLinks();
$res = [];
foreach ( $ill as $link ) {
list( $key, $title ) = explode( ':', $link, 2 );
[ $key, $title ] = explode( ':', $link, 2 );
$res[$key] = $title;
}
return $res;

View file

@ -448,7 +448,7 @@ class DiffEngine {
// need to store these so we don't lose them when they're
// overwritten by the recursion
list( $startx, $starty, $len ) = $snake;
[ $startx, $starty, $len ] = $snake;
// the middle snake is part of the LCS, store it
for ( $i = 0; $i < $len; ++$i ) {

View file

@ -1963,7 +1963,7 @@ class DifferenceEngine extends ContextSource {
$old = $this->mOldid;
$new = $this->mNewid;
list( $this->mOldid, $this->mNewid ) = self::mapDiffPrevNext( $old, $new );
[ $this->mOldid, $this->mNewid ] = self::mapDiffPrevNext( $old, $new );
if ( $new === 'next' && $this->mNewid === false ) {
# if no result, NewId points to the newest old revision. The only newer
# revision is cur, which is "0".

View file

@ -46,8 +46,8 @@ class WordLevelDiff extends \Diff {
* @param string[] $linesAfter
*/
public function __construct( $linesBefore, $linesAfter ) {
list( $wordsBefore, $wordsBeforeStripped ) = $this->split( $linesBefore );
list( $wordsAfter, $wordsAfterStripped ) = $this->split( $linesAfter );
[ $wordsBefore, $wordsBeforeStripped ] = $this->split( $linesBefore );
[ $wordsAfter, $wordsAfterStripped ] = $this->split( $linesAfter );
try {
parent::__construct( $wordsBeforeStripped, $wordsAfterStripped );

View file

@ -63,7 +63,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
* @see ExternalStoreMedium::fetchFromURL()
*/
public function fetchFromURL( $url ) {
list( $cluster, $id, $itemID ) = $this->parseURL( $url );
[ $cluster, $id, $itemID ] = $this->parseURL( $url );
$ret = $this->fetchBlob( $cluster, $id, $itemID );
if ( $itemID !== false && $ret !== false ) {
@ -86,7 +86,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
public function batchFetchFromURLs( array $urls ) {
$batched = $inverseUrlMap = [];
foreach ( $urls as $url ) {
list( $cluster, $id, $itemID ) = $this->parseURL( $url );
[ $cluster, $id, $itemID ] = $this->parseURL( $url );
$batched[$cluster][$id][] = $itemID;
// false $itemID gets cast to int, but should be ok
// since we do === from the $itemID in $batched

View file

@ -116,7 +116,7 @@ class ExternalStoreFactory implements LoggerAwareInterface {
* @since 1.34
*/
public function getStoreForUrl( $url, array $params = [] ) {
list( $proto, $path ) = self::splitStorageUrl( $url );
[ $proto, $path ] = self::splitStorageUrl( $url );
if ( $path == '' ) { // bad URL
throw new ExternalStoreException( "Invalid URL '$url'" );
}
@ -133,7 +133,7 @@ class ExternalStoreFactory implements LoggerAwareInterface {
* @since 1.34
*/
public function getStoreLocationFromUrl( $url ) {
list( , $location ) = self::splitStorageUrl( $url );
[ , $location ] = self::splitStorageUrl( $url );
if ( $location == '' ) { // bad URL
throw new ExternalStoreException( "Invalid URL '$url'" );
}
@ -150,7 +150,7 @@ class ExternalStoreFactory implements LoggerAwareInterface {
public function getUrlsByProtocol( array $urls ) {
$urlsByProtocol = [];
foreach ( $urls as $url ) {
list( $proto, ) = self::splitStorageUrl( $url );
[ $proto, ] = self::splitStorageUrl( $url );
$urlsByProtocol[$proto][] = $url;
}

View file

@ -36,7 +36,7 @@ class ExternalStoreMemory extends ExternalStoreMedium {
private static $nextId = 0;
public function fetchFromURL( $url ) {
list( $location, $id ) = self::getURLComponents( $url );
[ $location, $id ] = self::getURLComponents( $url );
if ( $id === null ) {
throw new UnexpectedValueException( "Missing ID in URL component." );
}
@ -81,7 +81,7 @@ class ExternalStoreMemory extends ExternalStoreMedium {
*/
private function getURLComponents( $url ) {
// @phan-suppress-next-line PhanSuspiciousBinaryAddLists It's intentional
list( $proto, $path ) = explode( '://', $url, 2 ) + [ null, null ];
[ $proto, $path ] = explode( '://', $url, 2 ) + [ null, null ];
if ( $proto !== 'memory' ) {
throw new UnexpectedValueException( "Got URL of protocol '$proto', not 'memory'." );
} elseif ( $path === null ) {

View file

@ -251,7 +251,7 @@ class FileBackendGroup {
* @return FileBackend|null Backend or null on failure
*/
public function backendFromPath( $storagePath ) {
list( $backend, , ) = FileBackend::splitStoragePath( $storagePath );
[ $backend, , ] = FileBackend::splitStoragePath( $storagePath );
if ( $backend !== null && isset( $this->backends[$backend] ) ) {
return $this->get( $backend );
}

View file

@ -103,7 +103,7 @@ class FileBackendDBRepoWrapper extends FileBackend {
continue;
}
list( , $container ) = FileBackend::splitStoragePath( $path );
[ , $container ] = FileBackend::splitStoragePath( $path );
if ( $container === "{$this->repoName}-public" ) {
$name = basename( $path );

View file

@ -360,7 +360,7 @@ class FileRepo {
if ( count( $bits ) != 3 ) {
throw new MWException( __METHOD__ . ": invalid mwrepo URL: $url" );
}
list( $repo, $zone, $rel ) = $bits;
[ $repo, $zone, $rel ] = $bits;
if ( $repo !== $this->name ) {
throw new MWException( __METHOD__ . ": fetching from a foreign repo is not supported" );
}
@ -393,7 +393,7 @@ class FileRepo {
* @return string|null Returns null if the zone is not defined
*/
public function getZonePath( $zone ) {
list( $container, $base ) = $this->getZoneLocation( $zone );
[ $container, $base ] = $this->getZoneLocation( $zone );
if ( $container === null || $base === null ) {
return null;
}
@ -947,7 +947,7 @@ class FileRepo {
$operations = [];
// Validate each triplet and get the store operation...
foreach ( $triplets as $triplet ) {
list( $src, $dstZone, $dstRel ) = $triplet;
[ $src, $dstZone, $dstRel ] = $triplet;
$srcPath = ( $src instanceof FSFile ) ? $src->getPath() : $src;
wfDebug( __METHOD__
. "( \$src='$srcPath', \$dstZone='$dstZone', \$dstRel='$dstRel' )"
@ -1012,7 +1012,7 @@ class FileRepo {
foreach ( $files as $path ) {
if ( is_array( $path ) ) {
// This is a pair, extract it
list( $zone, $rel ) = $path;
[ $zone, $rel ] = $path;
$path = $this->getZonePath( $zone ) . "/$rel";
} else {
// Resolve source to a storage path if virtual
@ -1068,7 +1068,7 @@ class FileRepo {
$status = $this->newGood();
$operations = [];
foreach ( $triples as $triple ) {
list( $src, $dst ) = $triple;
[ $src, $dst ] = $triple;
if ( $src instanceof FSFile ) {
$op = 'store';
} else {
@ -1295,7 +1295,7 @@ class FileRepo {
$sourceFSFilesToDelete = []; // cleanup for disk source files
// Validate each triplet and get the store operation...
foreach ( $ntuples as $ntuple ) {
list( $src, $dstRel, $archiveRel ) = $ntuple;
[ $src, $dstRel, $archiveRel ] = $ntuple;
$srcPath = ( $src instanceof FSFile ) ? $src->getPath() : $src;
$options = $ntuple[3] ?? [];
@ -1365,7 +1365,7 @@ class FileRepo {
$status->merge( $backend->doOperations( $operations ) );
// Find out which files were archived...
foreach ( $ntuples as $i => $ntuple ) {
list( , , $archiveRel ) = $ntuple;
[ , , $archiveRel ] = $ntuple;
$archivePath = $this->getZonePath( 'public' ) . "/$archiveRel";
if ( $this->fileExists( $archivePath ) ) {
$status->value[$i] = 'archived';
@ -1392,7 +1392,7 @@ class FileRepo {
*/
protected function initDirectory( $dir ) {
$path = $this->resolveToStoragePathIfVirtual( $dir );
list( , $container, ) = FileBackend::splitStoragePath( $path );
[ , $container, ] = FileBackend::splitStoragePath( $path );
$params = [ 'dir' => $path ];
if ( $this->isPrivate

View file

@ -441,7 +441,7 @@ class RepoGroup {
*/
public function getFileProps( $fileName ) {
if ( FileRepo::isVirtualUrl( $fileName ) ) {
list( $repoName, /* $zone */, /* $rel */ ) = $this->splitVirtualUrl( $fileName );
[ $repoName, /* $zone */, /* $rel */ ] = $this->splitVirtualUrl( $fileName );
if ( $repoName === '' ) {
$repoName = 'local';
}

View file

@ -556,7 +556,7 @@ class ArchivedFile {
$envelope['blobs'] = $this->metadataBlobs;
}
list( $s, $blobAddresses ) = $this->metadataStorageHelper->getJsonMetadata( $this, $envelope );
[ $s, $blobAddresses ] = $this->metadataStorageHelper->getJsonMetadata( $this, $envelope );
// Repeated calls to this function should not keep inserting more blobs
$this->metadataBlobs += $blobAddresses;

View file

@ -1096,7 +1096,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState {
return null;
}
$extension = $this->getExtension();
list( $thumbExt, ) = $this->getHandler()->getThumbType(
[ $thumbExt, ] = $this->getHandler()->getThumbType(
$extension, $this->getMimeType(), $params );
$thumbName = $this->getHandler()->makeParamString( $params );

View file

@ -822,7 +822,7 @@ class LocalFile extends File {
return;
}
list( $major, $minor ) = self::splitMime( $this->mime );
[ $major, $minor ] = self::splitMime( $this->mime );
wfDebug( __METHOD__ . ': upgrading ' . $this->getName() . " to the current schema" );
@ -906,7 +906,7 @@ class LocalFile extends File {
$this->mime = "{$info['major_mime']}/{$info['minor_mime']}";
} elseif ( isset( $info['mime'] ) ) {
$this->mime = $info['mime'];
list( $this->major_mime, $this->minor_mime ) = self::splitMime( $this->mime );
[ $this->major_mime, $this->minor_mime ] = self::splitMime( $this->mime );
}
if ( isset( $info['metadata'] ) ) {
@ -1153,7 +1153,7 @@ class LocalFile extends File {
$envelope['blobs'] = $this->metadataBlobs;
}
list( $s, $blobAddresses ) = $this->metadataStorageHelper->getJsonMetadata( $this, $envelope );
[ $s, $blobAddresses ] = $this->metadataStorageHelper->getJsonMetadata( $this, $envelope );
// Repeated calls to this function should not keep inserting more blobs
$this->metadataBlobs += $blobAddresses;

View file

@ -125,7 +125,7 @@ class LocalFileDeleteBatch {
*/
protected function getHashes( StatusValue $status ): array {
$hashes = [];
list( $oldRels, $deleteCurrent ) = $this->getOldRels();
[ $oldRels, $deleteCurrent ] = $this->getOldRels();
if ( $deleteCurrent ) {
$hashes['.'] = $this->file->getSha1();
@ -191,7 +191,7 @@ class LocalFileDeleteBatch {
$ext = $this->file->getExtension();
$dotExt = $ext === '' ? '' : ".$ext";
$encExt = $dbw->addQuotes( $dotExt );
list( $oldRels, $deleteCurrent ) = $this->getOldRels();
[ $oldRels, $deleteCurrent ] = $this->getOldRels();
// Bitfields to further suppress the content
if ( $this->suppress ) {
@ -290,7 +290,7 @@ class LocalFileDeleteBatch {
private function doDBDeletes() {
$dbw = $this->file->repo->getPrimaryDB();
list( $oldRels, $deleteCurrent ) = $this->getOldRels();
[ $oldRels, $deleteCurrent ] = $this->getOldRels();
if ( count( $oldRels ) ) {
$dbw->delete( 'oldimage',

View file

@ -138,7 +138,7 @@ class LocalFileMoveBatch {
continue;
}
list( $timestamp, $filename ) = $bits;
[ $timestamp, $filename ] = $bits;
if ( $this->oldName != $filename ) {
$this->logger->debug(

View file

@ -191,7 +191,7 @@ class LocalFileRestoreBatch {
// Required for a new current revision; nice for older ones too. :)
$this->file->loadFromFile( $deletedUrl );
$mime = $this->file->getMimeType();
list( $majorMime, $minorMime ) = File::splitMime( $mime );
[ $majorMime, $minorMime ] = File::splitMime( $mime );
$mediaInfo = [
'minor_mime' => $minorMime,
'major_mime' => $majorMime,

View file

@ -115,7 +115,7 @@ trait MediaFileTrait {
$transformInfo = null;
try {
list( $width, $height ) = $file->getDisplayWidthHeight( $maxWidth, $maxHeight );
[ $width, $height ] = $file->getDisplayWidthHeight( $maxWidth, $maxHeight );
$transform = $file->transform( [ 'width' => $width, 'height' => $height ] );
if ( $transform && !$transform->isError() ) {
// $file->getSize() returns original size. Only include if dimensions match.

View file

@ -354,7 +354,7 @@ class OldLocalFile extends LocalFile {
}
$dbw = $this->repo->getPrimaryDB();
list( $major, $minor ) = self::splitMime( $this->mime );
[ $major, $minor ] = self::splitMime( $this->mime );
wfDebug( __METHOD__ . ': upgrading ' . $this->archive_name . " to the current schema" );
$dbw->update( 'oldimage',

View file

@ -98,7 +98,7 @@ class TraditionalImageGallery extends ImageGalleryBase {
// @phan-suppress-next-line PhanTypeMismatchArgument Type mismatch on pass-by-ref args
$this->mParser, $nt, $options, $descQuery );
# Fetch and register the file (file title may be different via hooks)
list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $options );
[ $img, $nt ] = $this->mParser->fetchFileAndTitle( $nt, $options );
} else {
$img = $repoGroup->findFile( $nt );
}

View file

@ -1526,7 +1526,7 @@ class HTMLForm extends ContextSource {
}
$elementstr = false;
if ( $elements instanceof Status ) {
list( $errorStatus, $warningStatus ) = $elements->splitByErrorType();
[ $errorStatus, $warningStatus ] = $elements->splitByErrorType();
$status = $elementsType === 'error' ? $errorStatus : $warningStatus;
if ( $status->isGood() ) {
$elementstr = '';

View file

@ -224,7 +224,7 @@ abstract class HTMLFormField {
if ( count( $params ) !== 2 ) {
throw new MWException( "$op takes exactly two parameters" );
}
list( $name, $value ) = $params;
[ $name, $value ] = $params;
if ( !is_string( $name ) || !is_string( $value ) ) {
throw new MWException( "Parameters for $op must be strings" );
}
@ -272,7 +272,7 @@ abstract class HTMLFormField {
case '===':
case '!==':
list( $field, $value ) = $params;
[ $field, $value ] = $params;
$testValue = (string)$this->getNearestFieldValue( $alldata, $field, true, true );
switch ( $op ) {
case '===':
@ -310,7 +310,7 @@ abstract class HTMLFormField {
case '===':
case '!==':
list( $name, $value ) = $params;
[ $name, $value ] = $params;
$field = $this->getNearestField( $name, true );
return [ $op, $field->getName(), $value ];
}
@ -578,7 +578,7 @@ abstract class HTMLFormField {
* @return string Complete HTML table row.
*/
public function getTableRow( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
[ $errors, $errorClass ] = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
$fieldType = $this->getClassName();
$helptext = $this->getHelpTextHtmlTable( $this->getHelpText() );
@ -636,7 +636,7 @@ abstract class HTMLFormField {
* @return string Complete HTML table row.
*/
public function getDiv( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
[ $errors, $errorClass ] = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
$fieldType = $this->getClassName();
$helptext = $this->getHelpTextHtmlDiv( $this->getHelpText() );
@ -823,7 +823,7 @@ abstract class HTMLFormField {
* @return string Complete HTML table row.
*/
public function getRaw( $value ) {
list( $errors, ) = $this->getErrorsAndErrorClass( $value );
[ $errors, ] = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
$helptext = $this->getHelpTextHtmlRaw( $this->getHelpText() );
$cellAttributes = [];
@ -860,7 +860,7 @@ abstract class HTMLFormField {
* @return string Complete HTML inline element
*/
public function getInline( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
[ $errors, $errorClass ] = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
$helptext = $this->getHelpTextHtmlDiv( $this->getHelpText() );
$cellAttributes = [];

View file

@ -209,7 +209,7 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
* @return string Complete HTML table row
*/
public function getTableRow( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
[ $errors, $errorClass ] = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
$fieldType = $this->getClassName();
$helptext = $this->getHelpTextHtmlTable( $this->getHelpText() );

View file

@ -389,7 +389,7 @@ class HTMLFormFieldCloner extends HTMLFormField {
if ( $field instanceof HTMLHiddenField ) {
// HTMLHiddenField doesn't generate its own HTML
list( $name, $value, $params ) = $field->getHiddenFieldData( $v );
[ $name, $value, $params ] = $field->getHiddenFieldData( $v );
$hidden .= Html::hidden( $name, $value, $params ) . "\n";
} else {
$html .= $field->$getFieldHtmlMethod( $v );
@ -517,7 +517,7 @@ class HTMLFormFieldCloner extends HTMLFormField {
if ( $field instanceof HTMLHiddenField ) {
// HTMLHiddenField doesn't generate its own HTML
list( $name, $value, $params ) = $field->getHiddenFieldData( $v );
[ $name, $value, $params ] = $field->getHiddenFieldData( $v );
$hidden .= Html::hidden( $name, $value, $params ) . "\n";
} else {
$html .= $field->getOOUI( $v );

Some files were not shown because too many files have changed in this diff Show more