diff --git a/img_auth.php b/img_auth.php index cc44c5fda27..eea085103d5 100644 --- a/img_auth.php +++ b/img_auth.php @@ -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 ); } diff --git a/includes/ActorMigrationBase.php b/includes/ActorMigrationBase.php index 5a278ec50c4..691ed26e98f 100644 --- a/includes/ActorMigrationBase.php +++ b/includes/ActorMigrationBase.php @@ -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 ) { diff --git a/includes/CommentFormatter/CommentParser.php b/includes/CommentFormatter/CommentParser.php index 40a1e312c3a..0699254f3c1 100644 --- a/includes/CommentFormatter/CommentParser.php +++ b/includes/CommentFormatter/CommentParser.php @@ -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 ); diff --git a/includes/CommentStore.php b/includes/CommentStore.php index 5e5a0373ae5..fe5734c1764 100644 --- a/includes/CommentStore.php +++ b/includes/CommentStore.php @@ -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. diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 0d2aa05dad0..00417a9a57b 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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 ); diff --git a/includes/HeaderCallback.php b/includes/HeaderCallback.php index 6f106ed5aa8..80a4945f0ae 100644 --- a/includes/HeaderCallback.php +++ b/includes/HeaderCallback.php @@ -103,7 +103,7 @@ class HeaderCallback { foreach ( $values as $value ) { // Set-Cookie header format: =; $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"; diff --git a/includes/MagicWordArray.php b/includes/MagicWordArray.php index 8327eb85081..a16af17bb44 100644 --- a/includes/MagicWordArray.php +++ b/includes/MagicWordArray.php @@ -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 { diff --git a/includes/Maintenance/OrderedStreamingForkController.php b/includes/Maintenance/OrderedStreamingForkController.php index c6af57f4cc0..125dd6e070d 100644 --- a/includes/Maintenance/OrderedStreamingForkController.php +++ b/includes/Maintenance/OrderedStreamingForkController.php @@ -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 ); diff --git a/includes/ParamValidator/TypeDef/UserDef.php b/includes/ParamValidator/TypeDef/UserDef.php index cfa581f26d1..1e76524a74a 100644 --- a/includes/ParamValidator/TypeDef/UserDef.php +++ b/includes/ParamValidator/TypeDef/UserDef.php @@ -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 diff --git a/includes/Permissions/PermissionManager.php b/includes/Permissions/PermissionManager.php index 5e1ee8821c2..25547995299 100644 --- a/includes/Permissions/PermissionManager.php +++ b/includes/Permissions/PermissionManager.php @@ -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 diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 6b3a8026d7d..d3e44bd50cb 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -290,7 +290,7 @@ class ProtectionForm { return; } - list( $cascadeSources, /* $restrictions */ ) = + [ $cascadeSources, /* $restrictions */ ] = $this->restrictionStore->getCascadeProtectionSources( $this->mTitle ); if ( count( $cascadeSources ) > 0 ) { $titles = ''; diff --git a/includes/ResourceLoader/ClientHtml.php b/includes/ResourceLoader/ClientHtml.php index 6dc2c45632d..45563c9681b 100644 --- a/includes/ResourceLoader/ClientHtml.php +++ b/includes/ResourceLoader/ClientHtml.php @@ -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 ) { diff --git a/includes/ResourceLoader/FileModule.php b/includes/ResourceLoader/FileModule.php index 0f2650f07a2..53902c1d26b 100644 --- a/includes/ResourceLoader/FileModule.php +++ b/includes/ResourceLoader/FileModule.php @@ -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 ); diff --git a/includes/ResourceLoader/OOUIModule.php b/includes/ResourceLoader/OOUIModule.php index ddf7990b037..0d293b1a1bf 100644 --- a/includes/ResourceLoader/OOUIModule.php +++ b/includes/ResourceLoader/OOUIModule.php @@ -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 ) { diff --git a/includes/ResourceLoader/SkinModule.php b/includes/ResourceLoader/SkinModule.php index 6bf5774c4a0..f04c1bd8a16 100644 --- a/includes/ResourceLoader/SkinModule.php +++ b/includes/ResourceLoader/SkinModule.php @@ -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, diff --git a/includes/ResourceLoader/dependencystore/SqlModuleDependencyStore.php b/includes/ResourceLoader/dependencystore/SqlModuleDependencyStore.php index 865080ffab8..d2091db76db 100644 --- a/includes/ResourceLoader/dependencystore/SqlModuleDependencyStore.php +++ b/includes/ResourceLoader/dependencystore/SqlModuleDependencyStore.php @@ -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; } diff --git a/includes/Rest/Handler/MediaFileHandler.php b/includes/Rest/Handler/MediaFileHandler.php index 878a8d54c43..c124b642698 100644 --- a/includes/Rest/Handler/MediaFileHandler.php +++ b/includes/Rest/Handler/MediaFileHandler.php @@ -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 = [ diff --git a/includes/Rest/Handler/MediaLinksHandler.php b/includes/Rest/Handler/MediaLinksHandler.php index edd9227a7cc..4b36f5048c4 100644 --- a/includes/Rest/Handler/MediaLinksHandler.php +++ b/includes/Rest/Handler/MediaLinksHandler.php @@ -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' ); diff --git a/includes/Rest/Handler/PageHistoryCountHandler.php b/includes/Rest/Handler/PageHistoryCountHandler.php index e2969c93d49..cd1712fa2e2 100644 --- a/includes/Rest/Handler/PageHistoryCountHandler.php +++ b/includes/Rest/Handler/PageHistoryCountHandler.php @@ -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, diff --git a/includes/Rest/Handler/SearchHandler.php b/includes/Rest/Handler/SearchHandler.php index 603e278de60..f8b2e1b8d05 100644 --- a/includes/Rest/Handler/SearchHandler.php +++ b/includes/Rest/Handler/SearchHandler.php @@ -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( diff --git a/includes/Rest/HeaderContainer.php b/includes/Rest/HeaderContainer.php index 528bac1ad08..e7d0a477487 100644 --- a/includes/Rest/HeaderContainer.php +++ b/includes/Rest/HeaderContainer.php @@ -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 ) { diff --git a/includes/Rest/Validator/Validator.php b/includes/Rest/Validator/Validator.php index f04f263341a..03a63e5cfc0 100644 --- a/includes/Rest/Validator/Validator.php +++ b/includes/Rest/Validator/Validator.php @@ -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 diff --git a/includes/Revision/RevisionStore.php b/includes/Revision/RevisionStore.php index 1195450b6fa..be69b1eb337 100644 --- a/includes/Revision/RevisionStore.php +++ b/includes/Revision/RevisionStore.php @@ -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(); diff --git a/includes/Revision/RevisionStoreCacheRecord.php b/includes/Revision/RevisionStoreCacheRecord.php index 379b4b1d042..246e25e7a0a 100644 --- a/includes/Revision/RevisionStoreCacheRecord.php +++ b/includes/Revision/RevisionStoreCacheRecord.php @@ -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. diff --git a/includes/Settings/Source/EtcdSource.php b/includes/Settings/Source/EtcdSource.php index af48abc4d2a..9fc16edfe8b 100644 --- a/includes/Settings/Source/EtcdSource.php +++ b/includes/Settings/Source/EtcdSource.php @@ -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 ); diff --git a/includes/Status.php b/includes/Status.php index 4743172074d..0b6c5e503af 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -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'; diff --git a/includes/Storage/SqlBlobStore.php b/includes/Storage/SqlBlobStore.php index 030b3d25629..1b433643de0 100644 --- a/includes/Storage/SqlBlobStore.php +++ b/includes/Storage/SqlBlobStore.php @@ -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; diff --git a/includes/Title.php b/includes/Title.php index 8d8ce64a55f..40b725a39ba 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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']; diff --git a/includes/WikiMap.php b/includes/WikiMap.php index 94dfb2a41ed..1aef308af3b 100644 --- a/includes/WikiMap.php +++ b/includes/WikiMap.php @@ -53,7 +53,7 @@ class WikiMap { $wgConf->loadFullData(); - list( $major, $minor ) = $wgConf->siteFromDB( $wikiID ); + [ $major, $minor ] = $wgConf->siteFromDB( $wikiID ); if ( $major === null ) { return null; } diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 88f7d28bebe..d81e8f7cf06 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -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 ) { diff --git a/includes/actions/pagers/HistoryPager.php b/includes/actions/pagers/HistoryPager.php index c5d5746ce8b..fbf28be1d0e 100644 --- a/includes/actions/pagers/HistoryPager.php +++ b/includes/actions/pagers/HistoryPager.php @@ -501,7 +501,7 @@ class HistoryPager extends ReverseChronologicalPager { } # Tags - list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( + [ $tagSummary, $newClasses ] = ChangeTags::formatSummaryRow( $row->ts_tags, 'history', $this->getContext() diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index fc0b00812a5..50972daa68e 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -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 { diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 074c53cbe61..06a492ef969 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -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'] && diff --git a/includes/api/ApiComparePages.php b/includes/api/ApiComparePages.php index c30eb7da382..4275fc6242f 100644 --- a/includes/api/ApiComparePages.php +++ b/includes/api/ApiComparePages.php @@ -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) diff --git a/includes/api/ApiContinuationManager.php b/includes/api/ApiContinuationManager.php index 5ee8a948d25..570d067711d 100644 --- a/includes/api/ApiContinuationManager.php +++ b/includes/api/ApiContinuationManager.php @@ -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 ); diff --git a/includes/api/ApiModuleManager.php b/includes/api/ApiModuleManager.php index 582b37ad6b6..5c6b327dc99 100644 --- a/includes/api/ApiModuleManager.php +++ b/includes/api/ApiModuleManager.php @@ -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; diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index 62653af1773..5d9d9451565 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -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 ); } diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 0afe83662fd..7aaa5a0671e 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -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 ); } } diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 21506232fe7..ac38689ab98 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -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; diff --git a/includes/api/ApiQueryAllImages.php b/includes/api/ApiQueryAllImages.php index 7d5fcec4254..14118e2f189 100644 --- a/includes/api/ApiQueryAllImages.php +++ b/includes/api/ApiQueryAllImages.php @@ -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, diff --git a/includes/api/ApiQueryAllLinks.php b/includes/api/ApiQueryAllLinks.php index e89a546060f..e32a8cf0f95 100644 --- a/includes/api/ApiQueryAllLinks.php +++ b/includes/api/ApiQueryAllLinks.php @@ -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'] ); diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 639cadc1446..88f939063b0 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -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 ) { diff --git a/includes/api/ApiQueryBacklinksprop.php b/includes/api/ApiQueryBacklinksprop.php index 91d00883e03..d0821b65a1f 100644 --- a/includes/api/ApiQueryBacklinksprop.php +++ b/includes/api/ApiQueryBacklinksprop.php @@ -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 diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index 5c3d7ea190a..32a48d10236 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -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 ) ); diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 3d7bbe8bc51..c16e133489c 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -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; } diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index ff9b33538fb..068cd24317c 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -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 ) ) { diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index 6425f593451..430f3e5cfb7 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -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'] ); diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 8141f7e2bff..79defb1adbb 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -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 . '/*'] ); } diff --git a/includes/api/ApiQueryRandom.php b/includes/api/ApiQueryRandom.php index 4d1527ad304..d44a201097b 100644 --- a/includes/api/ApiQueryRandom.php +++ b/includes/api/ApiQueryRandom.php @@ -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 ) { diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 2c64853515c..666ef356972 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -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 ) diff --git a/includes/api/ApiQueryUserContribs.php b/includes/api/ApiQueryUserContribs.php index 03c996166e4..d990b4e0db4 100644 --- a/includes/api/ApiQueryUserContribs.php +++ b/includes/api/ApiQueryUserContribs.php @@ -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 ); diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 9e7a35e14dc..a3e1200d0b2 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -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 ); diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index a6971bc0198..820d67636fb 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -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 ); } diff --git a/includes/api/ApiUserrights.php b/includes/api/ApiUserrights.php index b6f1d12bceb..81f55c63dcf 100644 --- a/includes/api/ApiUserrights.php +++ b/includes/api/ApiUserrights.php @@ -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 diff --git a/includes/auth/ConfirmLinkSecondaryAuthenticationProvider.php b/includes/auth/ConfirmLinkSecondaryAuthenticationProvider.php index c2d730cbbd1..d8c4cf0906b 100644 --- a/includes/auth/ConfirmLinkSecondaryAuthenticationProvider.php +++ b/includes/auth/ConfirmLinkSecondaryAuthenticationProvider.php @@ -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', diff --git a/includes/auth/LocalPasswordPrimaryAuthenticationProvider.php b/includes/auth/LocalPasswordPrimaryAuthenticationProvider.php index ad6f130b749..1ebf5e84742 100644 --- a/includes/auth/LocalPasswordPrimaryAuthenticationProvider.php +++ b/includes/auth/LocalPasswordPrimaryAuthenticationProvider.php @@ -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', diff --git a/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php b/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php index 430a99c6b9e..40673073a76 100644 --- a/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php +++ b/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php @@ -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', diff --git a/includes/block/AbstractBlock.php b/includes/block/AbstractBlock.php index 2106177b264..8ae95b87176 100644 --- a/includes/block/AbstractBlock.php +++ b/includes/block/AbstractBlock.php @@ -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 ) { diff --git a/includes/block/BlockPermissionChecker.php b/includes/block/BlockPermissionChecker.php index dd101a95404..0fbf93468ac 100644 --- a/includes/block/BlockPermissionChecker.php +++ b/includes/block/BlockPermissionChecker.php @@ -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; } diff --git a/includes/block/BlockUser.php b/includes/block/BlockUser.php index a9d3e220cde..2e38b87527b 100644 --- a/includes/block/BlockUser.php +++ b/includes/block/BlockUser.php @@ -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 { diff --git a/includes/block/BlockUtils.php b/includes/block/BlockUtils.php index eedaefefdad..bf8f042c00e 100644 --- a/includes/block/BlockUtils.php +++ b/includes/block/BlockUtils.php @@ -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 ) ); diff --git a/includes/block/DatabaseBlock.php b/includes/block/DatabaseBlock.php index 16b527edea2..37918d59184 100644 --- a/includes/block/DatabaseBlock.php +++ b/includes/block/DatabaseBlock.php @@ -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 ) { diff --git a/includes/block/UnblockUser.php b/includes/block/UnblockUser.php index 18b36cac949..f8ae53a0301 100644 --- a/includes/block/UnblockUser.php +++ b/includes/block/UnblockUser.php @@ -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 ) diff --git a/includes/cache/BacklinkCache.php b/includes/cache/BacklinkCache.php index abdbd437c3d..2b62f304529 100644 --- a/includes/cache/BacklinkCache.php +++ b/includes/cache/BacklinkCache.php @@ -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 ); diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index 43c87774fd6..81124ce643e 100644 --- a/includes/cache/LinkBatch.php +++ b/includes/cache/LinkBatch.php @@ -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 { diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index 875e2e6e7fe..8528f7db3db 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -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() diff --git a/includes/changes/OldChangesList.php b/includes/changes/OldChangesList.php index f918c64aeea..c221ff580ac 100644 --- a/includes/changes/OldChangesList.php +++ b/includes/changes/OldChangesList.php @@ -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 ); diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 69f0187a2d2..11a04ca8e56 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -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 diff --git a/includes/changetags/ChangeTagsLogItem.php b/includes/changetags/ChangeTagsLogItem.php index ed100e6bd55..b035f2c0a74 100644 --- a/includes/changetags/ChangeTagsLogItem.php +++ b/includes/changetags/ChangeTagsLogItem.php @@ -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() diff --git a/includes/changetags/ChangeTagsRevisionItem.php b/includes/changetags/ChangeTagsRevisionItem.php index 7309e3c35d1..491833d1137 100644 --- a/includes/changetags/ChangeTagsRevisionItem.php +++ b/includes/changetags/ChangeTagsRevisionItem.php @@ -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() diff --git a/includes/config/EtcdConfig.php b/includes/config/EtcdConfig.php index f283f1ac1df..0e050f5a692 100644 --- a/includes/config/EtcdConfig.php +++ b/includes/config/EtcdConfig.php @@ -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' => [ diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index 1718a64cab8..648425df372 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -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 ); } diff --git a/includes/content/WikitextContent.php b/includes/content/WikitextContent.php index efa4c836cce..79aba3df4e7 100644 --- a/includes/content/WikitextContent.php +++ b/includes/content/WikitextContent.php @@ -188,7 +188,7 @@ class WikitextContent extends TextContent { * @see Content::getRedirectTarget */ public function getRedirectTarget() { - list( $title, ) = $this->getRedirectTargetAndText(); + [ $title, ] = $this->getRedirectTargetAndText(); return $title; } diff --git a/includes/content/WikitextContentHandler.php b/includes/content/WikitextContentHandler.php index 88b4fd679c4..c81f61ac2f6 100644 --- a/includes/content/WikitextContentHandler.php +++ b/includes/content/WikitextContentHandler.php @@ -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 ); diff --git a/includes/debug/DeprecationHelper.php b/includes/debug/DeprecationHelper.php index e9b7288bd5a..c5d1b45a057 100644 --- a/includes/debug/DeprecationHelper.php +++ b/includes/debug/DeprecationHelper.php @@ -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 ) { diff --git a/includes/deferred/CdnCacheUpdate.php b/includes/deferred/CdnCacheUpdate.php index f035d5e6e73..58ccd14000b 100644 --- a/includes/deferred/CdnCacheUpdate.php +++ b/includes/deferred/CdnCacheUpdate.php @@ -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 ); } diff --git a/includes/deferred/LinksUpdate/LinksUpdate.php b/includes/deferred/LinksUpdate/LinksUpdate.php index eb56e7f3186..57665b3cb0a 100644 --- a/includes/deferred/LinksUpdate/LinksUpdate.php +++ b/includes/deferred/LinksUpdate/LinksUpdate.php @@ -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; diff --git a/includes/diff/DiffEngine.php b/includes/diff/DiffEngine.php index d4f58d1a7cd..02874ce422f 100644 --- a/includes/diff/DiffEngine.php +++ b/includes/diff/DiffEngine.php @@ -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 ) { diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 7349739717c..b5f98e90305 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -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". diff --git a/includes/diff/WordLevelDiff.php b/includes/diff/WordLevelDiff.php index 9c26c6b82db..25d22bed054 100644 --- a/includes/diff/WordLevelDiff.php +++ b/includes/diff/WordLevelDiff.php @@ -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 ); diff --git a/includes/externalstore/ExternalStoreDB.php b/includes/externalstore/ExternalStoreDB.php index e6d0c27d470..d11202bc923 100644 --- a/includes/externalstore/ExternalStoreDB.php +++ b/includes/externalstore/ExternalStoreDB.php @@ -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 diff --git a/includes/externalstore/ExternalStoreFactory.php b/includes/externalstore/ExternalStoreFactory.php index fac2fd76fa7..a98c7041fbc 100644 --- a/includes/externalstore/ExternalStoreFactory.php +++ b/includes/externalstore/ExternalStoreFactory.php @@ -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; } diff --git a/includes/externalstore/ExternalStoreMemory.php b/includes/externalstore/ExternalStoreMemory.php index f8ba26f854a..d7c2a8da995 100644 --- a/includes/externalstore/ExternalStoreMemory.php +++ b/includes/externalstore/ExternalStoreMemory.php @@ -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 ) { diff --git a/includes/filebackend/FileBackendGroup.php b/includes/filebackend/FileBackendGroup.php index 4fe53e924dc..37286e1c62a 100644 --- a/includes/filebackend/FileBackendGroup.php +++ b/includes/filebackend/FileBackendGroup.php @@ -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 ); } diff --git a/includes/filerepo/FileBackendDBRepoWrapper.php b/includes/filerepo/FileBackendDBRepoWrapper.php index f8b03e06b9f..c0e8965c1ef 100644 --- a/includes/filerepo/FileBackendDBRepoWrapper.php +++ b/includes/filerepo/FileBackendDBRepoWrapper.php @@ -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 ); diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 7f8ae0591c6..20100b658b9 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -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 diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index c823e7b6a1f..0f222f033ea 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -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'; } diff --git a/includes/filerepo/file/ArchivedFile.php b/includes/filerepo/file/ArchivedFile.php index fad5428344b..8d55c4a870e 100644 --- a/includes/filerepo/file/ArchivedFile.php +++ b/includes/filerepo/file/ArchivedFile.php @@ -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; diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index c1b1c102e19..793b8967de4 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -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 ); diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index d6e24e9891b..ae8291aa968 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -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; diff --git a/includes/filerepo/file/LocalFileDeleteBatch.php b/includes/filerepo/file/LocalFileDeleteBatch.php index cddcec50952..29afd940b33 100644 --- a/includes/filerepo/file/LocalFileDeleteBatch.php +++ b/includes/filerepo/file/LocalFileDeleteBatch.php @@ -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', diff --git a/includes/filerepo/file/LocalFileMoveBatch.php b/includes/filerepo/file/LocalFileMoveBatch.php index 476f95ef6cc..99eaa13b135 100644 --- a/includes/filerepo/file/LocalFileMoveBatch.php +++ b/includes/filerepo/file/LocalFileMoveBatch.php @@ -138,7 +138,7 @@ class LocalFileMoveBatch { continue; } - list( $timestamp, $filename ) = $bits; + [ $timestamp, $filename ] = $bits; if ( $this->oldName != $filename ) { $this->logger->debug( diff --git a/includes/filerepo/file/LocalFileRestoreBatch.php b/includes/filerepo/file/LocalFileRestoreBatch.php index 762593fc3d5..5bb649ccc18 100644 --- a/includes/filerepo/file/LocalFileRestoreBatch.php +++ b/includes/filerepo/file/LocalFileRestoreBatch.php @@ -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, diff --git a/includes/filerepo/file/MediaFileTrait.php b/includes/filerepo/file/MediaFileTrait.php index ca255c4e4e6..0b715295494 100644 --- a/includes/filerepo/file/MediaFileTrait.php +++ b/includes/filerepo/file/MediaFileTrait.php @@ -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. diff --git a/includes/filerepo/file/OldLocalFile.php b/includes/filerepo/file/OldLocalFile.php index a75d0a4fa91..abf9e99f4ee 100644 --- a/includes/filerepo/file/OldLocalFile.php +++ b/includes/filerepo/file/OldLocalFile.php @@ -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', diff --git a/includes/gallery/TraditionalImageGallery.php b/includes/gallery/TraditionalImageGallery.php index dccd90cafbc..a8fcd9eea2b 100644 --- a/includes/gallery/TraditionalImageGallery.php +++ b/includes/gallery/TraditionalImageGallery.php @@ -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 ); } diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index b6e34e58ece..5b730ba3a27 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -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 = ''; diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 68ca6998d6b..dd29b3ece98 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -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 = []; diff --git a/includes/htmlform/fields/HTMLCheckMatrix.php b/includes/htmlform/fields/HTMLCheckMatrix.php index 667c95330ba..1a8d3b8c00b 100644 --- a/includes/htmlform/fields/HTMLCheckMatrix.php +++ b/includes/htmlform/fields/HTMLCheckMatrix.php @@ -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() ); diff --git a/includes/htmlform/fields/HTMLFormFieldCloner.php b/includes/htmlform/fields/HTMLFormFieldCloner.php index dbf0bc2bdba..d1271f52f00 100644 --- a/includes/htmlform/fields/HTMLFormFieldCloner.php +++ b/includes/htmlform/fields/HTMLFormFieldCloner.php @@ -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 ); diff --git a/includes/htmlform/fields/HTMLHiddenField.php b/includes/htmlform/fields/HTMLHiddenField.php index b931be208b5..a594662b2f7 100644 --- a/includes/htmlform/fields/HTMLHiddenField.php +++ b/includes/htmlform/fields/HTMLHiddenField.php @@ -36,7 +36,7 @@ class HTMLHiddenField extends HTMLFormField { } public function getTableRow( $value ) { - list( $name, $value, $params ) = $this->getHiddenFieldData( $value ); + [ $name, $value, $params ] = $this->getHiddenFieldData( $value ); $this->mParent->addHiddenField( $name, $value, $params ); return ''; } diff --git a/includes/htmlform/fields/HTMLUserTextField.php b/includes/htmlform/fields/HTMLUserTextField.php index f8e1b0d393c..593f7419330 100644 --- a/includes/htmlform/fields/HTMLUserTextField.php +++ b/includes/htmlform/fields/HTMLUserTextField.php @@ -89,7 +89,7 @@ class HTMLUserTextField extends HTMLTextField { return false; } - list( $ip, $range ) = explode( '/', $value, 2 ); + [ $ip, $range ] = explode( '/', $value, 2 ); if ( ( IPUtils::isIPv4( $ip ) && $cidrIPRanges['IPv4'] == 32 ) || diff --git a/includes/http/MWHttpRequest.php b/includes/http/MWHttpRequest.php index 758f11292fb..79adcc2cfde 100644 --- a/includes/http/MWHttpRequest.php +++ b/includes/http/MWHttpRequest.php @@ -491,7 +491,7 @@ abstract class MWHttpRequest implements LoggerAwareInterface { if ( (int)$this->respStatus > 0 && (int)$this->respStatus < 400 ) { $this->status->setResult( true, (int)$this->respStatus ); } else { - list( $code, $message ) = explode( " ", $this->respStatus, 2 ); + [ $code, $message ] = explode( " ", $this->respStatus, 2 ); $this->status->setResult( false, (int)$this->respStatus ); $this->status->fatal( "http-bad-status", $code, $message ); } diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php index 4e5706b59bf..1915042d0b3 100644 --- a/includes/import/WikiImporter.php +++ b/includes/import/WikiImporter.php @@ -925,7 +925,7 @@ class WikiImporter { // $title is either an array of two titles or false. if ( is_array( $title ) ) { $this->pageCallback( $title ); - list( $pageInfo['_title'], $foreignTitle ) = $title; + [ $pageInfo['_title'], $foreignTitle ] = $title; } else { $badTitle = true; $skip = true; diff --git a/includes/interwiki/ClassicInterwikiLookup.php b/includes/interwiki/ClassicInterwikiLookup.php index 0376d8d641c..bcd9352a0c7 100644 --- a/includes/interwiki/ClassicInterwikiLookup.php +++ b/includes/interwiki/ClassicInterwikiLookup.php @@ -245,7 +245,7 @@ class ClassicInterwikiLookup implements InterwikiLookup { */ private function makeFromPregen( string $prefix, string $value ) { // Split values - list( $local, $url ) = explode( ' ', $value, 2 ); + [ $local, $url ] = explode( ' ', $value, 2 ); return new Interwiki( $prefix, $url, '', '', (int)$local ); } @@ -282,7 +282,7 @@ class ClassicInterwikiLookup implements InterwikiLookup { continue; } - list( $iw_local, $iw_url ) = explode( ' ', $row ); + [ $iw_local, $iw_url ] = explode( ' ', $row ); if ( $local !== null && $local != $iw_local ) { continue; diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index 10f52288e93..e115ac83d23 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -191,7 +191,7 @@ class JobRunner implements LoggerAwareInterface { return $response; } - list( , $maxLag ) = $this->lbFactory->getMainLB()->getMaxLag(); + [ , $maxLag ] = $this->lbFactory->getMainLB()->getMaxLag(); if ( $maxLag >= self::MAX_ALLOWED_LAG ) { // DB lag is already too high; caller can immediately try other wikis if applicable $response['reached'] = 'replica-lag-limit'; @@ -591,7 +591,7 @@ class JobRunner implements LoggerAwareInterface { if ( $maxBytes === null ) { $m = []; if ( preg_match( '!^(\d+)(k|m|g|)$!i', ini_get( 'memory_limit' ), $m ) ) { - list( , $num, $unit ) = $m; + [ , $num, $unit ] = $m; $conv = [ 'g' => 1073741824, 'm' => 1048576, 'k' => 1024, '' => 1 ]; $maxBytes = (int)$num * $conv[strtolower( $unit )]; } else { diff --git a/includes/jobqueue/jobs/CategoryMembershipChangeJob.php b/includes/jobqueue/jobs/CategoryMembershipChangeJob.php index 597a6c6db97..f6616ecc152 100644 --- a/includes/jobqueue/jobs/CategoryMembershipChangeJob.php +++ b/includes/jobqueue/jobs/CategoryMembershipChangeJob.php @@ -206,7 +206,7 @@ class CategoryMembershipChangeJob extends Job { // Parse the new revision and get the categories $categoryChanges = $this->getExplicitCategoriesChanges( $page, $newRev, $oldRev ); - list( $categoryInserts, $categoryDeletes ) = $categoryChanges; + [ $categoryInserts, $categoryDeletes ] = $categoryChanges; if ( !$categoryInserts && !$categoryDeletes ) { return; // nothing to do } diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php b/includes/jobqueue/jobs/RefreshLinksJob.php index 72cac26641f..b975f697471 100644 --- a/includes/jobqueue/jobs/RefreshLinksJob.php +++ b/includes/jobqueue/jobs/RefreshLinksJob.php @@ -146,7 +146,7 @@ class RefreshLinksJob extends Job { } elseif ( isset( $this->params['pages'] ) ) { // Job to update link tables for a set of titles - foreach ( $this->params['pages'] as list( $ns, $dbKey ) ) { + foreach ( $this->params['pages'] as [ $ns, $dbKey ] ) { $title = Title::makeTitleSafe( $ns, $dbKey ); if ( $title && $title->canExist() ) { $ok = $this->runForTitle( $title ) && $ok; diff --git a/includes/jobqueue/utils/BacklinkJobUtils.php b/includes/jobqueue/utils/BacklinkJobUtils.php index b61fb3ed4c3..1dc8ffedcff 100644 --- a/includes/jobqueue/utils/BacklinkJobUtils.php +++ b/includes/jobqueue/utils/BacklinkJobUtils.php @@ -114,7 +114,7 @@ class BacklinkJobUtils { $jobs = []; // Combine the first range (of size $bSize) backlinks into leaf jobs if ( isset( $ranges[0] ) ) { - list( $start, $end ) = $ranges[0]; + [ $start, $end ] = $ranges[0]; $iter = $backlinkCache->getLinkPages( $params['table'], $start, $end ); $pageSources = iterator_to_array( $iter ); diff --git a/includes/language/LCStoreStaticArray.php b/includes/language/LCStoreStaticArray.php index f3256c82b53..8462dbda0ca 100644 --- a/includes/language/LCStoreStaticArray.php +++ b/includes/language/LCStoreStaticArray.php @@ -120,7 +120,7 @@ class LCStoreStaticArray implements LCStore { return $encoded; } - list( $type, $data ) = $encoded; + [ $type, $data ] = $encoded; switch ( $type ) { case 'v': diff --git a/includes/language/Language.php b/includes/language/Language.php index 020dca08ea1..73fcea60b1c 100644 --- a/includes/language/Language.php +++ b/includes/language/Language.php @@ -3730,7 +3730,7 @@ class Language { } elseif ( $dispLen > $length && $dispLen > strlen( $ellipsis ) ) { # String in fact does need truncation, the truncation point was OK. // @phan-suppress-next-line PhanTypeInvalidExpressionArrayDestructuring - list( $ret, $openTags ) = $maybeState; // reload state + [ $ret, $openTags ] = $maybeState; // reload state $ret = $this->removeBadCharLast( $ret ); // multi-byte char fix $ret .= $ellipsis; // add ellipsis break; diff --git a/includes/language/Message.php b/includes/language/Message.php index 279450b0f77..f9274bd10e1 100644 --- a/includes/language/Message.php +++ b/includes/language/Message.php @@ -1302,7 +1302,7 @@ class Message implements MessageSpecifier, Serializable { $marker = $format === self::FORMAT_ESCAPED ? '$' : '$\'"'; $replacementKeys = []; foreach ( $this->parameters as $n => $param ) { - list( $paramType, $value ) = $this->extractParam( $param, $format ); + [ $paramType, $value ] = $this->extractParam( $param, $format ); if ( $type === 'before' ) { if ( $paramType === 'before' ) { $replacementKeys['$' . ( $n + 1 )] = $value; @@ -1543,7 +1543,7 @@ class Message implements MessageSpecifier, Serializable { $vars = []; $list = []; foreach ( $params as $n => $p ) { - list( $type, $value ) = $this->extractParam( $p, $format ); + [ $type, $value ] = $this->extractParam( $p, $format ); $types[$type] = true; $list[] = $value; $vars[] = '$' . ( $n + 1 ); diff --git a/includes/language/MessageCache.php b/includes/language/MessageCache.php index 52e00a8c6be..f3af3dc1337 100644 --- a/includes/language/MessageCache.php +++ b/includes/language/MessageCache.php @@ -337,7 +337,7 @@ class MessageCache implements LoggerAwareInterface { // Hash of the contents is stored in memcache, to detect if data-center cache // or local cache goes out of date (e.g. due to replace() on some other server) - list( $hash, $hashVolatile ) = $this->getValidationHash( $code ); + [ $hash, $hashVolatile ] = $this->getValidationHash( $code ); $this->cacheVolatile[$code] = $hashVolatile; // Try the local cache and check against the cluster hash key... @@ -730,7 +730,7 @@ class MessageCache implements LoggerAwareInterface { return; } - list( $msg, $code ) = $this->figureMessage( $title ); + [ $msg, $code ] = $this->figureMessage( $title ); if ( strpos( $title, '/' ) !== false && $code === $this->contLangCode ) { // Content language overrides do not use the / suffix return; @@ -762,7 +762,7 @@ class MessageCache implements LoggerAwareInterface { $this->clusterCache->makeKey( 'messages', $code ) ); if ( !$scopedLock ) { - foreach ( $replacements as list( $title ) ) { + foreach ( $replacements as [ $title ] ) { $this->logger->error( __METHOD__ . ': could not acquire lock to update {title} ({code})', [ 'title' => $title, 'code' => $code ] ); @@ -785,7 +785,7 @@ class MessageCache implements LoggerAwareInterface { // Can not inject the WikiPageFactory as it would break the installer since // it instantiates MessageCache before the DB. $wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory(); - foreach ( $replacements as list( $title ) ) { + foreach ( $replacements as [ $title ] ) { $page = $wikiPageFactory->newFromTitle( Title::makeTitle( NS_MEDIAWIKI, $title ) ); $page->loadPageData( $page::READ_LATEST ); $text = $this->getMessageTextFromContent( $page->getContent() ); @@ -834,7 +834,7 @@ class MessageCache implements LoggerAwareInterface { // Purge the messages in the message blob store and fire any hook handlers $blobStore = MediaWikiServices::getInstance()->getResourceLoader()->getMessageBlobStore(); - foreach ( $replacements as list( $title, $msg ) ) { + foreach ( $replacements as [ $title, $msg ] ) { $blobStore->updateMessage( $this->contLang->lcfirst( $msg ) ); $this->hookRunner->onMessageCacheReplace( $title, $newTextByTitle[$title] ); } diff --git a/includes/language/converters/CrhConverter.php b/includes/language/converters/CrhConverter.php index be4275b75ba..bc9a46a3c1f 100644 --- a/includes/language/converters/CrhConverter.php +++ b/includes/language/converters/CrhConverter.php @@ -197,8 +197,8 @@ class CrhConverter extends LanguageConverterSpecific { $this->mExceptionsLoaded = true; $crhExceptions = new MediaWiki\Languages\Data\CrhExceptions(); - list( $this->mCyrl2LatnExceptions, $this->mLatn2CyrlExceptions, - $this->mCyrl2LatnPatterns, $this->mLatn2CyrlPatterns, $this->mCyrlCleanUpRegexes ) = + [ $this->mCyrl2LatnExceptions, $this->mLatn2CyrlExceptions, + $this->mCyrl2LatnPatterns, $this->mLatn2CyrlPatterns, $this->mCyrlCleanUpRegexes ] = $crhExceptions->loadExceptions( self::L_LC . self::C_LC, self::L_UC . self::C_UC ); } diff --git a/includes/languages/LanguageFi.php b/includes/languages/LanguageFi.php index ce2c748cb81..68be28c682f 100644 --- a/includes/languages/LanguageFi.php +++ b/includes/languages/LanguageFi.php @@ -156,7 +156,7 @@ class LanguageFi extends Language { foreach ( $tokens as $item ) { if ( !is_numeric( $item ) ) { if ( count( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) { - list( $yyyy, $mm, $dd ) = explode( '-', $item ); + [ $yyyy, $mm, $dd ] = explode( '-', $item ); $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" ); continue; } diff --git a/includes/languages/LanguageKk_cyrl.php b/includes/languages/LanguageKk_cyrl.php index 4baf3021e26..5b441faa42a 100644 --- a/includes/languages/LanguageKk_cyrl.php +++ b/includes/languages/LanguageKk_cyrl.php @@ -65,7 +65,7 @@ class LanguageKk_cyrl extends Language { $secondPerson = [ "ะท" ]; // 1st plural, 2nd formal $thirdPerson = [ "ั‹", "ั–" ]; // 3rd - list( $wordEnding, $wordLastVowel ) = $this->lastLetter( $word, $allVowels ); + [ $wordEnding, $wordLastVowel ] = $this->lastLetter( $word, $allVowels ); // Now convert the word switch ( $case ) { @@ -298,7 +298,7 @@ class LanguageKk_cyrl extends Language { $secondPerson = [ "z" ]; // 1st plural, 2nd formal $thirdPerson = [ "ฤฑ", "i" ]; // 3rd - list( $wordEnding, $wordLastVowel ) = $this->lastLetter( $word, $allVowels ); + [ $wordEnding, $wordLastVowel ] = $this->lastLetter( $word, $allVowels ); // Now convert the word switch ( $case ) { @@ -531,7 +531,7 @@ class LanguageKk_cyrl extends Language { $secondPerson = [ "ุฒ" ]; // 1st plural, 2nd formal $thirdPerson = [ "ู‰", "ูธ" ]; // 3rd - list( $wordEnding, $wordLastVowel ) = $this->lastLetter( $word, $allVowels ); + [ $wordEnding, $wordLastVowel ] = $this->lastLetter( $word, $allVowels ); // Now convert the word switch ( $case ) { diff --git a/includes/libs/CookieJar.php b/includes/libs/CookieJar.php index 8f5700abb91..00f2684e669 100644 --- a/includes/libs/CookieJar.php +++ b/includes/libs/CookieJar.php @@ -83,7 +83,7 @@ class CookieJar { $bit = array_map( 'trim', explode( ';', $cookie ) ); if ( count( $bit ) >= 1 ) { - list( $name, $value ) = explode( '=', array_shift( $bit ), 2 ); + [ $name, $value ] = explode( '=', array_shift( $bit ), 2 ); $attr = []; foreach ( $bit as $piece ) { diff --git a/includes/libs/XhprofData.php b/includes/libs/XhprofData.php index 2aa02e639f9..e4fb59fc2b0 100644 --- a/includes/libs/XhprofData.php +++ b/includes/libs/XhprofData.php @@ -130,7 +130,7 @@ class XhprofData { $keep = []; foreach ( $data as $key => $stats ) { - list( $parent, $child ) = self::splitKey( $key ); + [ $parent, $child ] = self::splitKey( $key ); if ( isset( $want[$parent] ) || isset( $want[$child] ) ) { $keep[$key] = $stats; } @@ -165,7 +165,7 @@ class XhprofData { $inclusive = []; foreach ( $this->hieraData as $key => $stats ) { - list( $parent, $child ) = self::splitKey( $key ); + [ $parent, $child ] = self::splitKey( $key ); if ( !isset( $inclusive[$child] ) ) { $inclusive[$child] = [ 'ct' => 0, @@ -262,7 +262,7 @@ class XhprofData { } foreach ( $this->hieraData as $key => $stats ) { - list( $parent, $child ) = self::splitKey( $key ); + [ $parent, $child ] = self::splitKey( $key ); if ( $parent !== null ) { // Track call tree information $this->complete[$child]['calls'][$parent] = $stats; diff --git a/includes/libs/filebackend/FSFileBackend.php b/includes/libs/filebackend/FSFileBackend.php index 52bce87d925..c47f633b804 100644 --- a/includes/libs/filebackend/FSFileBackend.php +++ b/includes/libs/filebackend/FSFileBackend.php @@ -188,11 +188,11 @@ class FSFileBackend extends FileBackendStore { * @return string|null */ protected function resolveToFSPath( $storagePath ) { - list( $fullCont, $relPath ) = $this->resolveStoragePathReal( $storagePath ); + [ $fullCont, $relPath ] = $this->resolveStoragePathReal( $storagePath ); if ( $relPath === null ) { return null; // invalid } - list( , $shortCont, ) = FileBackend::splitStoragePath( $storagePath ); + [ , $shortCont, ] = FileBackend::splitStoragePath( $storagePath ); $fsPath = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid if ( $relPath != '' ) { $fsPath .= "/{$relPath}"; @@ -485,7 +485,7 @@ class FSFileBackend extends FileBackendStore { */ protected function doPrepareInternal( $fullCont, $dirRel, array $params ) { $status = $this->newStatus(); - list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = FileBackend::splitStoragePath( $params['dir'] ); $contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid $fsDirectory = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot; // Create the directory and its parents as needed... @@ -521,7 +521,7 @@ class FSFileBackend extends FileBackendStore { protected function doSecureInternal( $fullCont, $dirRel, array $params ) { $status = $this->newStatus(); - list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = FileBackend::splitStoragePath( $params['dir'] ); $contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid $fsDirectory = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot; // Seed new directories with a blank index.html, to prevent crawling... @@ -549,7 +549,7 @@ class FSFileBackend extends FileBackendStore { protected function doPublishInternal( $fullCont, $dirRel, array $params ) { $status = $this->newStatus(); - list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = FileBackend::splitStoragePath( $params['dir'] ); $contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid $fsDirectory = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot; // Unseed new directories with a blank index.html, to allow crawling... @@ -573,7 +573,7 @@ class FSFileBackend extends FileBackendStore { protected function doCleanInternal( $fullCont, $dirRel, array $params ) { $status = $this->newStatus(); - list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = FileBackend::splitStoragePath( $params['dir'] ); $contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid $fsDirectory = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot; @@ -620,7 +620,7 @@ class FSFileBackend extends FileBackendStore { } protected function doDirectoryExists( $fullCont, $dirRel, array $params ) { - list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = FileBackend::splitStoragePath( $params['dir'] ); $contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid $fsDirectory = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot; @@ -639,7 +639,7 @@ class FSFileBackend extends FileBackendStore { * @return array|FSFileBackendDirList|null */ public function getDirectoryListInternal( $fullCont, $dirRel, array $params ) { - list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = FileBackend::splitStoragePath( $params['dir'] ); $contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid $fsDirectory = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot; @@ -672,7 +672,7 @@ class FSFileBackend extends FileBackendStore { * @return array|FSFileBackendFileList|null */ public function getFileListInternal( $fullCont, $dirRel, array $params ) { - list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = FileBackend::splitStoragePath( $params['dir'] ); $contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid $fsDirectory = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot; diff --git a/includes/libs/filebackend/FileBackend.php b/includes/libs/filebackend/FileBackend.php index db6cb3970fe..5176f3ac568 100644 --- a/includes/libs/filebackend/FileBackend.php +++ b/includes/libs/filebackend/FileBackend.php @@ -1543,7 +1543,7 @@ abstract class FileBackend implements LoggerAwareInterface { * @return string|null Normalized storage path or null on failure */ final public static function normalizeStoragePath( $storagePath ) { - list( $backend, $container, $relPath ) = self::splitStoragePath( $storagePath ); + [ $backend, $container, $relPath ] = self::splitStoragePath( $storagePath ); if ( $relPath !== null ) { // must be for this backend $relPath = self::normalizeContainerPath( $relPath ); if ( $relPath !== null ) { @@ -1569,7 +1569,7 @@ abstract class FileBackend implements LoggerAwareInterface { // doesn't contain characters like '\', behavior can vary by platform. We should use // explode() instead. $storagePath = dirname( $storagePath ); - list( , , $rel ) = self::splitStoragePath( $storagePath ); + [ , , $rel ] = self::splitStoragePath( $storagePath ); return ( $rel === null ) ? null : $storagePath; } diff --git a/includes/libs/filebackend/FileBackendStore.php b/includes/libs/filebackend/FileBackendStore.php index 1f7eff271e9..fed56c6eef2 100644 --- a/includes/libs/filebackend/FileBackendStore.php +++ b/includes/libs/filebackend/FileBackendStore.php @@ -479,7 +479,7 @@ abstract class FileBackendStore extends FileBackend { $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" ); $status = $this->newStatus(); - list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] ); + [ $fullCont, $dir, $shard ] = $this->resolveStoragePath( $params['dir'] ); if ( $dir === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dir'] ); @@ -490,7 +490,7 @@ abstract class FileBackendStore extends FileBackend { $status->merge( $this->doPrepareInternal( $fullCont, $dir, $params ) ); } else { // directory is on several shards $this->logger->debug( __METHOD__ . ": iterating over all container shards." ); - list( , $shortCont, ) = self::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = self::splitStoragePath( $params['dir'] ); foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) { $status->merge( $this->doPrepareInternal( "{$fullCont}{$suffix}", $dir, $params ) ); } @@ -516,7 +516,7 @@ abstract class FileBackendStore extends FileBackend { $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" ); $status = $this->newStatus(); - list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] ); + [ $fullCont, $dir, $shard ] = $this->resolveStoragePath( $params['dir'] ); if ( $dir === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dir'] ); @@ -527,7 +527,7 @@ abstract class FileBackendStore extends FileBackend { $status->merge( $this->doSecureInternal( $fullCont, $dir, $params ) ); } else { // directory is on several shards $this->logger->debug( __METHOD__ . ": iterating over all container shards." ); - list( , $shortCont, ) = self::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = self::splitStoragePath( $params['dir'] ); foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) { $status->merge( $this->doSecureInternal( "{$fullCont}{$suffix}", $dir, $params ) ); } @@ -553,7 +553,7 @@ abstract class FileBackendStore extends FileBackend { $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" ); $status = $this->newStatus(); - list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] ); + [ $fullCont, $dir, $shard ] = $this->resolveStoragePath( $params['dir'] ); if ( $dir === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dir'] ); @@ -564,7 +564,7 @@ abstract class FileBackendStore extends FileBackend { $status->merge( $this->doPublishInternal( $fullCont, $dir, $params ) ); } else { // directory is on several shards $this->logger->debug( __METHOD__ . ": iterating over all container shards." ); - list( , $shortCont, ) = self::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = self::splitStoragePath( $params['dir'] ); foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) { $status->merge( $this->doPublishInternal( "{$fullCont}{$suffix}", $dir, $params ) ); } @@ -602,7 +602,7 @@ abstract class FileBackendStore extends FileBackend { } } - list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] ); + [ $fullCont, $dir, $shard ] = $this->resolveStoragePath( $params['dir'] ); if ( $dir === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dir'] ); @@ -622,7 +622,7 @@ abstract class FileBackendStore extends FileBackend { $this->deleteContainerCache( $fullCont ); // purge cache } else { // directory is on several shards $this->logger->debug( __METHOD__ . ": iterating over all container shards." ); - list( , $shortCont, ) = self::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = self::splitStoragePath( $params['dir'] ); foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) { $status->merge( $this->doCleanInternal( "{$fullCont}{$suffix}", $dir, $params ) ); $this->deleteContainerCache( "{$fullCont}{$suffix}" ); // purge cache @@ -1100,7 +1100,7 @@ abstract class FileBackendStore extends FileBackend { } final public function directoryExists( array $params ) { - list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] ); + [ $fullCont, $dir, $shard ] = $this->resolveStoragePath( $params['dir'] ); if ( $dir === null ) { return self::EXISTENCE_ERROR; // invalid storage path } @@ -1108,7 +1108,7 @@ abstract class FileBackendStore extends FileBackend { return $this->doDirectoryExists( $fullCont, $dir, $params ); } else { // directory is on several shards $this->logger->debug( __METHOD__ . ": iterating over all container shards." ); - list( , $shortCont, ) = self::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = self::splitStoragePath( $params['dir'] ); $res = false; // response foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) { $exists = $this->doDirectoryExists( "{$fullCont}{$suffix}", $dir, $params ); @@ -1135,7 +1135,7 @@ abstract class FileBackendStore extends FileBackend { abstract protected function doDirectoryExists( $container, $dir, array $params ); final public function getDirectoryList( array $params ) { - list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] ); + [ $fullCont, $dir, $shard ] = $this->resolveStoragePath( $params['dir'] ); if ( $dir === null ) { return self::EXISTENCE_ERROR; // invalid storage path } @@ -1145,7 +1145,7 @@ abstract class FileBackendStore extends FileBackend { } else { $this->logger->debug( __METHOD__ . ": iterating over all container shards." ); // File listing spans multiple containers/shards - list( , $shortCont, ) = self::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = self::splitStoragePath( $params['dir'] ); return new FileBackendStoreShardDirIterator( $this, $fullCont, $dir, $this->getContainerSuffixes( $shortCont ), $params ); @@ -1165,7 +1165,7 @@ abstract class FileBackendStore extends FileBackend { abstract public function getDirectoryListInternal( $container, $dir, array $params ); final public function getFileList( array $params ) { - list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] ); + [ $fullCont, $dir, $shard ] = $this->resolveStoragePath( $params['dir'] ); if ( $dir === null ) { return self::LIST_ERROR; // invalid storage path } @@ -1175,7 +1175,7 @@ abstract class FileBackendStore extends FileBackend { } else { $this->logger->debug( __METHOD__ . ": iterating over all container shards." ); // File listing spans multiple containers/shards - list( , $shortCont, ) = self::splitStoragePath( $params['dir'] ); + [ , $shortCont, ] = self::splitStoragePath( $params['dir'] ); return new FileBackendStoreShardFileIterator( $this, $fullCont, $dir, $this->getContainerSuffixes( $shortCont ), $params ); @@ -1476,7 +1476,7 @@ abstract class FileBackendStore extends FileBackend { final public function preloadCache( array $paths ) { $fullConts = []; // full container names foreach ( $paths as $path ) { - list( $fullCont, , ) = $this->resolveStoragePath( $path ); + [ $fullCont, , ] = $this->resolveStoragePath( $path ); $fullConts[] = $fullCont; } // Load from the persistent file and container caches @@ -1602,7 +1602,7 @@ abstract class FileBackendStore extends FileBackend { * @return array (container, path, container suffix) or (null, null, null) if invalid */ final protected function resolveStoragePath( $storagePath ) { - list( $backend, $shortCont, $relPath ) = self::splitStoragePath( $storagePath ); + [ $backend, $shortCont, $relPath ] = self::splitStoragePath( $storagePath ); if ( $backend === $this->name ) { // must be for this backend $relPath = self::normalizeContainerPath( $relPath ); if ( $relPath !== null && self::isValidShortContainerName( $shortCont ) ) { @@ -1643,7 +1643,7 @@ abstract class FileBackendStore extends FileBackend { * @return array (container, path) or (null, null) if invalid */ final protected function resolveStoragePathReal( $storagePath ) { - list( $container, $relPath, $cShard ) = $this->resolveStoragePath( $storagePath ); + [ $container, $relPath, $cShard ] = $this->resolveStoragePath( $storagePath ); if ( $cShard !== null && substr( $relPath, -1 ) !== '/' ) { return [ $container, $relPath ]; } @@ -1660,7 +1660,7 @@ abstract class FileBackendStore extends FileBackend { * @return string|null Returns null if shard could not be determined */ final protected function getContainerShard( $container, $relPath ) { - list( $levels, $base, $repeat ) = $this->getContainerHashLevels( $container ); + [ $levels, $base, $repeat ] = $this->getContainerHashLevels( $container ); if ( $levels == 1 || $levels == 2 ) { // Hash characters are either base 16 or 36 $char = ( $base == 36 ) ? '[0-9a-z]' : '[0-9a-f]'; @@ -1698,7 +1698,7 @@ abstract class FileBackendStore extends FileBackend { * @return bool */ final public function isSingleShardPathInternal( $storagePath ) { - list( , , $shard ) = $this->resolveStoragePath( $storagePath ); + [ , , $shard ] = $this->resolveStoragePath( $storagePath ); return ( $shard !== null ); } @@ -1734,7 +1734,7 @@ abstract class FileBackendStore extends FileBackend { */ final protected function getContainerSuffixes( $container ) { $shards = []; - list( $digits, $base ) = $this->getContainerHashLevels( $container ); + [ $digits, $base ] = $this->getContainerHashLevels( $container ); if ( $digits > 0 ) { $numShards = $base ** $digits; for ( $index = 0; $index < $numShards; $index++ ) { @@ -1844,7 +1844,7 @@ abstract class FileBackendStore extends FileBackend { } // Get all the corresponding cache keys for paths... foreach ( $paths as $path ) { - list( $fullCont, , ) = $this->resolveStoragePath( $path ); + [ $fullCont, , ] = $this->resolveStoragePath( $path ); if ( $fullCont !== null ) { // valid path for this backend $contNames[$this->containerCacheKey( $fullCont )] = $fullCont; } @@ -1948,7 +1948,7 @@ abstract class FileBackendStore extends FileBackend { $paths = array_filter( $paths, 'strlen' ); // remove nulls // Get all the corresponding cache keys for paths... foreach ( $paths as $path ) { - list( , $rel, ) = $this->resolveStoragePath( $path ); + [ , $rel, ] = $this->resolveStoragePath( $path ); if ( $rel !== null ) { // valid path for this backend $pathNames[$this->fileCacheKey( $path )] = $path; } diff --git a/includes/libs/filebackend/HTTPFileStreamer.php b/includes/libs/filebackend/HTTPFileStreamer.php index 968a18620cd..3683a36a4e7 100644 --- a/includes/libs/filebackend/HTTPFileStreamer.php +++ b/includes/libs/filebackend/HTTPFileStreamer.php @@ -228,7 +228,7 @@ class HTTPFileStreamer { public static function parseRange( $range, $size ) { $m = []; if ( preg_match( '#^bytes=(\d*)-(\d*)$#', $range, $m ) ) { - list( , $start, $end ) = $m; + [ , $start, $end ] = $m; if ( $start === '' && $end === '' ) { $absRange = [ 0, $size - 1 ]; } elseif ( $start === '' ) { diff --git a/includes/libs/filebackend/MemoryFileBackend.php b/includes/libs/filebackend/MemoryFileBackend.php index 6e57af9eb3d..a214c2dd79f 100644 --- a/includes/libs/filebackend/MemoryFileBackend.php +++ b/includes/libs/filebackend/MemoryFileBackend.php @@ -257,7 +257,7 @@ class MemoryFileBackend extends FileBackendStore { * @return string|null */ protected function resolveHashKey( $storagePath ) { - list( $fullCont, $relPath ) = $this->resolveStoragePathReal( $storagePath ); + [ $fullCont, $relPath ] = $this->resolveStoragePathReal( $storagePath ); if ( $relPath === null ) { return null; // invalid } diff --git a/includes/libs/filebackend/SwiftFileBackend.php b/includes/libs/filebackend/SwiftFileBackend.php index e92a93f8ff5..3cbd47e0109 100644 --- a/includes/libs/filebackend/SwiftFileBackend.php +++ b/includes/libs/filebackend/SwiftFileBackend.php @@ -185,7 +185,7 @@ class SwiftFileBackend extends FileBackendStore { } public function isPathUsableInternal( $storagePath ) { - list( $container, $rel ) = $this->resolveStoragePathReal( $storagePath ); + [ $container, $rel ] = $this->resolveStoragePathReal( $storagePath ); if ( $rel === null ) { return false; // invalid } @@ -273,7 +273,7 @@ class SwiftFileBackend extends FileBackendStore { protected function doCreateInternal( array $params ) { $status = $this->newStatus(); - list( $dstCont, $dstRel ) = $this->resolveStoragePathReal( $params['dst'] ); + [ $dstCont, $dstRel ] = $this->resolveStoragePathReal( $params['dst'] ); if ( $dstRel === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); @@ -303,7 +303,7 @@ class SwiftFileBackend extends FileBackendStore { $method = __METHOD__; $handler = function ( array $request, StatusValue $status ) use ( $method, $params ) { - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $request['response']; if ( $rcode === 201 || $rcode === 202 ) { // good } elseif ( $rcode === 412 ) { @@ -328,7 +328,7 @@ class SwiftFileBackend extends FileBackendStore { protected function doStoreInternal( array $params ) { $status = $this->newStatus(); - list( $dstCont, $dstRel ) = $this->resolveStoragePathReal( $params['dst'] ); + [ $dstCont, $dstRel ] = $this->resolveStoragePathReal( $params['dst'] ); if ( $dstRel === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); @@ -390,7 +390,7 @@ class SwiftFileBackend extends FileBackendStore { $method = __METHOD__; $handler = function ( array $request, StatusValue $status ) use ( $method, $params ) { - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $request['response']; if ( $rcode === 201 || $rcode === 202 ) { // good } elseif ( $rcode === 412 ) { @@ -417,14 +417,14 @@ class SwiftFileBackend extends FileBackendStore { protected function doCopyInternal( array $params ) { $status = $this->newStatus(); - list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); + [ $srcCont, $srcRel ] = $this->resolveStoragePathReal( $params['src'] ); if ( $srcRel === null ) { $status->fatal( 'backend-fail-invalidpath', $params['src'] ); return $status; } - list( $dstCont, $dstRel ) = $this->resolveStoragePathReal( $params['dst'] ); + [ $dstCont, $dstRel ] = $this->resolveStoragePathReal( $params['dst'] ); if ( $dstRel === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); @@ -445,7 +445,7 @@ class SwiftFileBackend extends FileBackendStore { $method = __METHOD__; $handler = function ( array $request, StatusValue $status ) use ( $method, $params ) { - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $request['response']; if ( $rcode === 201 ) { // good } elseif ( $rcode === 404 ) { @@ -472,14 +472,14 @@ class SwiftFileBackend extends FileBackendStore { protected function doMoveInternal( array $params ) { $status = $this->newStatus(); - list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); + [ $srcCont, $srcRel ] = $this->resolveStoragePathReal( $params['src'] ); if ( $srcRel === null ) { $status->fatal( 'backend-fail-invalidpath', $params['src'] ); return $status; } - list( $dstCont, $dstRel ) = $this->resolveStoragePathReal( $params['dst'] ); + [ $dstCont, $dstRel ] = $this->resolveStoragePathReal( $params['dst'] ); if ( $dstRel === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); @@ -507,7 +507,7 @@ class SwiftFileBackend extends FileBackendStore { $method = __METHOD__; $handler = function ( array $request, StatusValue $status ) use ( $method, $params ) { - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $request['response']; if ( $request['method'] === 'PUT' && $rcode === 201 ) { // good } elseif ( $request['method'] === 'DELETE' && $rcode === 204 ) { @@ -539,7 +539,7 @@ class SwiftFileBackend extends FileBackendStore { protected function doDeleteInternal( array $params ) { $status = $this->newStatus(); - list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); + [ $srcCont, $srcRel ] = $this->resolveStoragePathReal( $params['src'] ); if ( $srcRel === null ) { $status->fatal( 'backend-fail-invalidpath', $params['src'] ); @@ -554,7 +554,7 @@ class SwiftFileBackend extends FileBackendStore { $method = __METHOD__; $handler = function ( array $request, StatusValue $status ) use ( $method, $params ) { - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $request['response']; if ( $rcode === 204 ) { // good } elseif ( $rcode === 404 ) { @@ -581,7 +581,7 @@ class SwiftFileBackend extends FileBackendStore { protected function doDescribeInternal( array $params ) { $status = $this->newStatus(); - list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); + [ $srcCont, $srcRel ] = $this->resolveStoragePathReal( $params['src'] ); if ( $srcRel === null ) { $status->fatal( 'backend-fail-invalidpath', $params['src'] ); @@ -617,7 +617,7 @@ class SwiftFileBackend extends FileBackendStore { $method = __METHOD__; $handler = function ( array $request, StatusValue $status ) use ( $method, $params ) { - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $request['response']; if ( $rcode === 202 ) { // good } elseif ( $rcode === 404 ) { @@ -811,8 +811,8 @@ class SwiftFileBackend extends FileBackendStore { $objHdrs['x-object-meta-sha1base36'] = $hash; // Merge new SHA1 header into the old ones $postHeaders['x-object-meta-sha1base36'] = $hash; - list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $path ); - list( $rcode ) = $this->http->run( [ + [ $srcCont, $srcRel ] = $this->resolveStoragePathReal( $path ); + [ $rcode ] = $this->http->run( [ 'method' => 'POST', 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), 'headers' => $this->authTokenHeaders( $auth ) + $postHeaders @@ -843,7 +843,7 @@ class SwiftFileBackend extends FileBackendStore { // Initial dummy values to preserve path order $contents = array_fill_keys( $params['srcs'], self::$RES_ERROR ); foreach ( $params['srcs'] as $path ) { // each path in this concurrent batch - list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $path ); + [ $srcCont, $srcRel ] = $this->resolveStoragePathReal( $path ); if ( $srcRel === null || !$auth ) { continue; // invalid storage path or auth error } @@ -865,7 +865,7 @@ class SwiftFileBackend extends FileBackendStore { ] + self::DEFAULT_HTTP_OPTIONS; $reqs = $this->http->runMulti( $reqs, $opts ); foreach ( $reqs as $path => $op ) { - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $op['response']; + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $op['response']; if ( $rcode >= 200 && $rcode <= 299 ) { rewind( $op['stream'] ); // start from the beginning $content = (string)stream_get_contents( $op['stream'] ); @@ -1140,7 +1140,7 @@ class SwiftFileBackend extends FileBackendStore { $flags = !empty( $params['headless'] ) ? HTTPFileStreamer::STREAM_HEADLESS : 0; - list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); + [ $srcCont, $srcRel ] = $this->resolveStoragePathReal( $params['src'] ); if ( $srcRel === null ) { HTTPFileStreamer::send404Message( $params['src'], $flags ); $status->fatal( 'backend-fail-invalidpath', $params['src'] ); @@ -1176,7 +1176,7 @@ class SwiftFileBackend extends FileBackendStore { } $handle = fopen( 'php://output', 'wb' ); - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( [ + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->http->run( [ 'method' => 'GET', 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), 'headers' => $this->authTokenHeaders( $auth ) @@ -1212,7 +1212,7 @@ class SwiftFileBackend extends FileBackendStore { // Initial dummy values to preserve path order $tmpFiles = array_fill_keys( $params['srcs'], self::$RES_ERROR ); foreach ( $params['srcs'] as $path ) { // each path in this concurrent batch - list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $path ); + [ $srcCont, $srcRel ] = $this->resolveStoragePathReal( $path ); if ( $srcRel === null || !$auth ) { continue; // invalid storage path or auth error } @@ -1241,7 +1241,7 @@ class SwiftFileBackend extends FileBackendStore { ] + self::DEFAULT_HTTP_OPTIONS; $reqs = $this->http->runMulti( $reqs, $opts ); foreach ( $reqs as $path => $op ) { - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $op['response']; + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $op['response']; fclose( $op['stream'] ); // close open handle if ( $rcode >= 200 && $rcode <= 299 ) { /** @var TempFSFile $tmpFile */ @@ -1279,7 +1279,7 @@ class SwiftFileBackend extends FileBackendStore { if ( $this->swiftTempUrlKey != '' || ( $this->rgwS3AccessKey != '' && $this->rgwS3SecretKey != '' ) ) { - list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); + [ $srcCont, $srcRel ] = $this->resolveStoragePathReal( $params['src'] ); if ( $srcRel === null ) { return self::TEMPURL_ERROR; // invalid path } @@ -1372,7 +1372,7 @@ class SwiftFileBackend extends FileBackendStore { $reqs = $fileOpHandle->httpOp; // Convert the 'url' parameter to an actual URL using $auth foreach ( $reqs as $stage => &$req ) { - list( $container, $relPath ) = $req['url']; + [ $container, $relPath ] = $req['url']; $req['url'] = $this->storageUrl( $auth, $container, $relPath ); $req['headers'] ??= []; $req['headers'] = $this->authTokenHeaders( $auth ) + $req['headers']; @@ -1440,7 +1440,7 @@ class SwiftFileBackend extends FileBackendStore { return $status; } - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( [ + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->http->run( [ 'method' => 'POST', 'url' => $this->storageUrl( $auth, $container ), 'headers' => $this->authTokenHeaders( $auth ) + [ @@ -1481,7 +1481,7 @@ class SwiftFileBackend extends FileBackendStore { return self::$RES_ERROR; } - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( [ + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->http->run( [ 'method' => 'HEAD', 'url' => $this->storageUrl( $auth, $container ), 'headers' => $this->authTokenHeaders( $auth ) @@ -1539,7 +1539,7 @@ class SwiftFileBackend extends FileBackendStore { $writeUsers = array_merge( $this->secureWriteUsers, [ $this->swiftUser ] ); } - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( [ + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->http->run( [ 'method' => 'PUT', 'url' => $this->storageUrl( $auth, $container ), 'headers' => $this->authTokenHeaders( $auth ) + [ @@ -1576,7 +1576,7 @@ class SwiftFileBackend extends FileBackendStore { return $status; } - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( [ + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->http->run( [ 'method' => 'DELETE', 'url' => $this->storageUrl( $auth, $container ), 'headers' => $this->authTokenHeaders( $auth ) @@ -1634,7 +1634,7 @@ class SwiftFileBackend extends FileBackendStore { $query['delimiter'] = $delim; } - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( [ + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->http->run( [ 'method' => 'GET', 'url' => $this->storageUrl( $auth, $fullCont ), 'query' => $query, @@ -1673,7 +1673,7 @@ class SwiftFileBackend extends FileBackendStore { $reqs = []; // (path => op) // (a) Check the containers of the paths... foreach ( $params['srcs'] as $path ) { - list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $path ); + [ $srcCont, $srcRel ] = $this->resolveStoragePathReal( $path ); if ( $srcRel === null || !$auth ) { $stats[$path] = self::$RES_ERROR; continue; // invalid storage path or auth error @@ -1701,7 +1701,7 @@ class SwiftFileBackend extends FileBackendStore { ] + self::DEFAULT_HTTP_OPTIONS; $reqs = $this->http->runMulti( $reqs, $opts ); foreach ( $reqs as $path => $op ) { - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $op['response']; + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $op['response']; if ( $rcode === 200 || $rcode === 204 ) { // Update the object if it is missing some headers if ( !empty( $params['requireSHA1'] ) ) { @@ -1770,7 +1770,7 @@ class SwiftFileBackend extends FileBackendStore { // Skew the timestamp for worst case to avoid using stale credentials $this->authSessionTimestamp = time() - (int)ceil( $this->authTTL / 2 ); } else { // cache miss - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( [ + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->http->run( [ 'method' => 'GET', 'url' => "{$this->swiftAuthUrl}/v1.0", 'headers' => [ diff --git a/includes/libs/filebackend/fileiteration/SwiftFileBackendFileList.php b/includes/libs/filebackend/fileiteration/SwiftFileBackendFileList.php index 106193d710e..5bd1488196a 100644 --- a/includes/libs/filebackend/fileiteration/SwiftFileBackendFileList.php +++ b/includes/libs/filebackend/fileiteration/SwiftFileBackendFileList.php @@ -32,7 +32,7 @@ class SwiftFileBackendFileList extends SwiftFileBackendList { */ #[\ReturnTypeWillChange] public function current() { - list( $path, $stat ) = current( $this->bufferIter ); + [ $path, $stat ] = current( $this->bufferIter ); $relPath = substr( $path, $this->suffixStart ); if ( is_array( $stat ) ) { $storageDir = rtrim( $this->params['dir'], '/' ); diff --git a/includes/libs/filebackend/fileop/FileOp.php b/includes/libs/filebackend/fileop/FileOp.php index cebe1fa8920..261fa603e82 100644 --- a/includes/libs/filebackend/fileop/FileOp.php +++ b/includes/libs/filebackend/fileop/FileOp.php @@ -85,7 +85,7 @@ abstract class FileOp { ) { $this->backend = $backend; $this->logger = $logger; - list( $required, $optional, $paths ) = $this->allowedParams(); + [ $required, $optional, $paths ] = $this->allowedParams(); foreach ( $required as $name ) { if ( isset( $params[$name] ) ) { $this->params[$name] = $params[$name]; diff --git a/includes/libs/filebackend/fsfile/FSFile.php b/includes/libs/filebackend/fsfile/FSFile.php index 63483faf5d5..2bda5c5416a 100644 --- a/includes/libs/filebackend/fsfile/FSFile.php +++ b/includes/libs/filebackend/fsfile/FSFile.php @@ -124,9 +124,9 @@ class FSFile { $info['mime'] = $mime; if ( strpos( $mime, '/' ) !== false ) { - list( $info['major_mime'], $info['minor_mime'] ) = explode( '/', $mime, 2 ); + [ $info['major_mime'], $info['minor_mime'] ] = explode( '/', $mime, 2 ); } else { - list( $info['major_mime'], $info['minor_mime'] ) = [ $mime, 'unknown' ]; + [ $info['major_mime'], $info['minor_mime'] ] = [ $mime, 'unknown' ]; } } diff --git a/includes/libs/http/MultiHttpClient.php b/includes/libs/http/MultiHttpClient.php index 386c4210c98..8808d7091ea 100644 --- a/includes/libs/http/MultiHttpClient.php +++ b/includes/libs/http/MultiHttpClient.php @@ -143,7 +143,7 @@ class MultiHttpClient implements LoggerAwareInterface { * - error : Any error string * The map also stores integer-indexed copies of these values. This lets callers do: * @code - * list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $http->run( $req ); + * [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $http->run( $req ); * @endcode * @param array $req HTTP request array * @param array $opts @@ -173,7 +173,7 @@ class MultiHttpClient implements LoggerAwareInterface { * - error : Any error string * The map also stores integer-indexed copies of these values. This lets callers do: * @code - * list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $req['response']; + * [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $req['response']; * @endcode * All headers in the 'headers' field are normalized to use lower case names. * This is true for the request headers and the response headers. Integer-indexed @@ -323,7 +323,7 @@ class MultiHttpClient implements LoggerAwareInterface { $req['response']['error'] = "(curl error: no status set)"; } - // For convenience with the list() operator + // For convenience with array destructuring $req['response'][0] = $req['response']['code']; $req['response'][1] = $req['response']['reason']; $req['response'][2] = $req['response']['headers']; @@ -449,7 +449,7 @@ class MultiHttpClient implements LoggerAwareInterface { if ( strpos( $header, ":" ) === false ) { return $length; } - list( $name, $value ) = explode( ":", $header, 2 ); + [ $name, $value ] = explode( ":", $header, 2 ); $name = strtolower( $name ); $value = trim( $value ); if ( isset( $req['response']['headers'][$name] ) ) { diff --git a/includes/libs/mime/XmlTypeCheck.php b/includes/libs/mime/XmlTypeCheck.php index 26714c7cca8..d17eeaa7a9c 100644 --- a/includes/libs/mime/XmlTypeCheck.php +++ b/includes/libs/mime/XmlTypeCheck.php @@ -323,7 +323,7 @@ class XmlTypeCheck { } private function elementClose() { - list( $name, $attribs ) = array_pop( $this->elementDataContext ); + [ $name, $attribs ] = array_pop( $this->elementDataContext ); $data = array_pop( $this->elementData ); $this->stackDepth--; $callbackReturn = false; diff --git a/includes/libs/objectcache/MediumSpecificBagOStuff.php b/includes/libs/objectcache/MediumSpecificBagOStuff.php index 3976c7f78d2..0878fa913b4 100644 --- a/includes/libs/objectcache/MediumSpecificBagOStuff.php +++ b/includes/libs/objectcache/MediumSpecificBagOStuff.php @@ -1148,7 +1148,7 @@ abstract class MediumSpecificBagOStuff extends BagOStuff { foreach ( $keyInfo as $indexOrKey => $keyOrSizes ) { if ( is_array( $keyOrSizes ) ) { $key = $indexOrKey; - list( $sPayloadSize, $rPayloadSize ) = $keyOrSizes; + [ $sPayloadSize, $rPayloadSize ] = $keyOrSizes; } else { $key = $keyOrSizes; $sPayloadSize = 0; diff --git a/includes/libs/objectcache/RESTBagOStuff.php b/includes/libs/objectcache/RESTBagOStuff.php index 41a2453c960..90eacd663f6 100644 --- a/includes/libs/objectcache/RESTBagOStuff.php +++ b/includes/libs/objectcache/RESTBagOStuff.php @@ -185,7 +185,7 @@ class RESTBagOStuff extends MediumSpecificBagOStuff { $value = false; $valueSize = false; - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->client->run( $req ); + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->client->run( $req ); if ( $rcode === 200 && is_string( $rbody ) ) { $value = $this->decodeBody( $rbody ); $valueSize = strlen( $rbody ); @@ -210,7 +210,7 @@ class RESTBagOStuff extends MediumSpecificBagOStuff { 'headers' => $this->httpParams['writeHeaders'], ]; - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->client->run( $req ); + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->client->run( $req ); $res = ( $rcode === 200 || $rcode === 201 || $rcode === 204 ); if ( !$res ) { $this->handleError( "Failed to store $key", $rcode, $rerr, $rhdrs, $rbody ); @@ -238,7 +238,7 @@ class RESTBagOStuff extends MediumSpecificBagOStuff { 'headers' => $this->httpParams['deleteHeaders'], ]; - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->client->run( $req ); + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->client->run( $req ); $res = in_array( $rcode, [ 200, 204, 205, 404, 410 ] ); if ( !$res ) { $this->handleError( "Failed to delete $key", $rcode, $rerr, $rhdrs, $rbody ); @@ -304,7 +304,7 @@ class RESTBagOStuff extends MediumSpecificBagOStuff { if ( count( $pieces ) !== 3 || $pieces[0] !== $this->serializationType ) { return false; } - list( , $hmac, $serialized ) = $pieces; + [ , $hmac, $serialized ] = $pieces; if ( $this->hmacKey !== '' ) { $checkHmac = hash_hmac( 'sha256', $serialized, $this->hmacKey, true ); if ( !hash_equals( $checkHmac, base64_decode( $hmac ) ) ) { diff --git a/includes/libs/objectcache/wancache/WANObjectCache.php b/includes/libs/objectcache/wancache/WANObjectCache.php index e09950ac489..29d8f70fda0 100644 --- a/includes/libs/objectcache/wancache/WANObjectCache.php +++ b/includes/libs/objectcache/wancache/WANObjectCache.php @@ -1525,7 +1525,7 @@ class WANObjectCache implements // Regenerate the variant value if it is not newer than the main value at $key // so that purges to the main key propagate to the variant value. $this->logger->debug( "getWithSetCallback($key): using variant key" ); - list( $value ) = $this->fetchOrRegenerate( + [ $value ] = $this->fetchOrRegenerate( $this->makeGlobalKey( 'WANCache-key-variant', md5( $key ), (string)$version ), $ttl, $callback, @@ -3057,7 +3057,7 @@ class WANObjectCache implements */ private function getProcessCache( $group ) { if ( !isset( $this->processCaches[$group] ) ) { - list( , $size ) = explode( ':', $group ); + [ , $size ] = explode( ':', $group ); $this->processCaches[$group] = new MapCacheLRU( (int)$size ); if ( $this->wallClockOverride !== null ) { $this->processCaches[$group]->setMockTime( $this->wallClockOverride ); diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 04f2aba3785..b541eb58502 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -687,7 +687,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware protected function assertIsWritablePrimary() { $info = $this->getReadOnlyReason(); if ( $info ) { - list( $reason, $source ) = $info; + [ $reason, $source ] = $info; if ( $source === 'role' ) { throw new DBReadOnlyRoleError( $this, "Database is read-only: $reason" ); } else { @@ -828,7 +828,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware return; } - foreach ( $changes as list( $tmpTableType, $verb, $table ) ) { + foreach ( $changes as [ $tmpTableType, $verb, $table ] ) { switch ( $verb ) { case 'CREATE': $this->sessionTempTables[$table] = [ @@ -998,7 +998,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $pseudoPermanent = $this->flagsHolder::contains( $flags, self::QUERY_PSEUDO_PERMANENT ); $tempTableChanges = $this->getTempTableWrites( $sql, $pseudoPermanent ); $isPermWrite = !$tempTableChanges; - foreach ( $tempTableChanges as list( $tmpType ) ) { + foreach ( $tempTableChanges as [ $tmpType ] ) { $isPermWrite = $isPermWrite || ( $tmpType !== self::TEMP_NORMAL ); } // Permit temporary table writes on replica connections, but require a writable @@ -2577,7 +2577,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware } final public function endAtomic( $fname = __METHOD__ ) { - list( $savepointId, $sectionId ) = $this->transactionManager->onEndAtomic( $this, $fname ); + [ $savepointId, $sectionId ] = $this->transactionManager->onEndAtomic( $this, $fname ); $runPostCommitCallbacks = false; @@ -2620,7 +2620,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $cs = $this->commenceCriticalSection( __METHOD__ ); $runPostRollbackCallbacks = false; - list( $savedFname, $excisedIds, $newTopSection, $savedSectionId, $savepointId ) = + [ $savedFname, $excisedIds, $newTopSection, $savedSectionId, $savepointId ] = $this->transactionManager->cancelAtomic( $pos ); try { diff --git a/includes/libs/rdbms/database/DatabaseMysqlBase.php b/includes/libs/rdbms/database/DatabaseMysqlBase.php index e17b25901c7..bf0537b0455 100644 --- a/includes/libs/rdbms/database/DatabaseMysqlBase.php +++ b/includes/libs/rdbms/database/DatabaseMysqlBase.php @@ -349,7 +349,7 @@ abstract class DatabaseMysqlBase extends Database { public function tableExists( $table, $fname = __METHOD__ ) { // Split database and table into proper variables as Database::tableName() returns // shared tables prefixed with their database, which do not work in SHOW TABLES statements - list( $database, , $prefix, $table ) = $this->platform->qualifiedTableComponents( $table ); + [ $database, , $prefix, $table ] = $this->platform->qualifiedTableComponents( $table ); $tableName = "{$prefix}{$table}"; if ( isset( $this->sessionTempTables[$tableName] ) ) { @@ -884,7 +884,7 @@ abstract class DatabaseMysqlBase extends Database { * @return string */ public function getSoftwareLink() { - list( $variant ) = $this->getMySqlServerVariant(); + [ $variant ] = $this->getMySqlServerVariant(); if ( $variant === 'MariaDB' ) { return '[{{int:version-db-mariadb-url}} MariaDB]'; } @@ -1054,7 +1054,7 @@ abstract class DatabaseMysqlBase extends Database { string $fname ) { $encTable = $this->tableName( $table ); - list( $sqlColumns, $sqlTuples ) = $this->platform->makeInsertLists( $rows ); + [ $sqlColumns, $sqlTuples ] = $this->platform->makeInsertLists( $rows ); $sqlColumnAssignments = $this->makeList( $set, self::LIST_SET ); // No need to expose __NEW.* since buildExcludedValue() uses VALUES(column) @@ -1070,7 +1070,7 @@ abstract class DatabaseMysqlBase extends Database { protected function doReplace( $table, array $identityKey, array $rows, $fname ) { $encTable = $this->tableName( $table ); - list( $sqlColumns, $sqlTuples ) = $this->platform->makeInsertLists( $rows ); + [ $sqlColumns, $sqlTuples ] = $this->platform->makeInsertLists( $rows ); $sql = "REPLACE INTO $encTable ($sqlColumns) VALUES $sqlTuples"; @@ -1256,7 +1256,7 @@ abstract class DatabaseMysqlBase extends Database { // https://mariadb.com/kb/en/library/aborting-statements/ $timeoutMsec = intval( $options['MAX_EXECUTION_TIME'] ?? 0 ); if ( $timeoutMsec > 0 ) { - list( $vendor, $number ) = $this->getMySqlServerVariant(); + [ $vendor, $number ] = $this->getMySqlServerVariant(); if ( $vendor === 'MariaDB' && version_compare( $number, '10.1.2', '>=' ) ) { $timeoutSec = $timeoutMsec / 1000; $sql = "SET STATEMENT max_statement_time=$timeoutSec FOR $sql"; diff --git a/includes/libs/rdbms/database/DatabaseMysqli.php b/includes/libs/rdbms/database/DatabaseMysqli.php index bcdfae5dff8..8dd3fa468fc 100644 --- a/includes/libs/rdbms/database/DatabaseMysqli.php +++ b/includes/libs/rdbms/database/DatabaseMysqli.php @@ -137,7 +137,7 @@ class DatabaseMysqli extends DatabaseMysqlBase { } elseif ( substr_count( $server, ':/' ) == 1 ) { // If we have a colon slash instead of a colon and a port number // after the ip or hostname, assume it's the Unix domain socket path - list( $realServer, $socket ) = explode( ':', $server, 2 ); + [ $realServer, $socket ] = explode( ':', $server, 2 ); } else { $realServer = $server; } diff --git a/includes/libs/rdbms/database/DatabaseSqlite.php b/includes/libs/rdbms/database/DatabaseSqlite.php index 9b598b2e592..69548b4a975 100644 --- a/includes/libs/rdbms/database/DatabaseSqlite.php +++ b/includes/libs/rdbms/database/DatabaseSqlite.php @@ -535,7 +535,7 @@ class DatabaseSqlite extends Database { protected function doReplace( $table, array $identityKey, array $rows, $fname ) { $encTable = $this->tableName( $table ); - list( $sqlColumns, $sqlTuples ) = $this->platform->makeInsertLists( $rows ); + [ $sqlColumns, $sqlTuples ] = $this->platform->makeInsertLists( $rows ); // https://sqlite.org/lang_insert.html $this->query( "REPLACE INTO $encTable ($sqlColumns) VALUES $sqlTuples", diff --git a/includes/libs/rdbms/database/TransactionManager.php b/includes/libs/rdbms/database/TransactionManager.php index 3dcfef3d490..4e542b7d07f 100644 --- a/includes/libs/rdbms/database/TransactionManager.php +++ b/includes/libs/rdbms/database/TransactionManager.php @@ -207,7 +207,7 @@ class TransactionManager { $this->trxStatusCause ); } elseif ( $this->trxStatus === self::STATUS_TRX_OK && $this->trxStatusIgnoredCause ) { - list( $iLastError, $iLastErrno, $iFname ) = $this->trxStatusIgnoredCause; + [ $iLastError, $iLastErrno, $iFname ] = $this->trxStatusIgnoredCause; call_user_func( $deprecationLogger, "Caller from $fname ignored an error originally raised from $iFname: " . "[$iLastErrno] $iLastError" @@ -481,7 +481,7 @@ class TransactionManager { } // Check if the current section matches $fname $pos = count( $this->trxAtomicLevels ) - 1; - list( $savedFname, $sectionId, $savepointId ) = $this->trxAtomicLevels[$pos]; + [ $savedFname, $sectionId, $savepointId ] = $this->trxAtomicLevels[$pos]; $this->logger->debug( "endAtomic: leaving level $pos ($fname)", [ 'db_log_category' => 'trx' ] ); if ( $savedFname !== $fname ) { @@ -498,7 +498,7 @@ class TransactionManager { if ( $sectionId !== null ) { // Find the (last) section with the given $sectionId $pos = -1; - foreach ( $this->trxAtomicLevels as $i => list( $asFname, $asId, $spId ) ) { + foreach ( $this->trxAtomicLevels as $i => [ $asFname, $asId, $spId ] ) { if ( $asId === $sectionId ) { $pos = $i; } @@ -527,7 +527,7 @@ class TransactionManager { // Check if the current section matches $fname $pos = count( $this->trxAtomicLevels ) - 1; - list( $savedFname, $savedSectionId, $savepointId ) = $this->trxAtomicLevels[$pos]; + [ $savedFname, $savedSectionId, $savepointId ] = $this->trxAtomicLevels[$pos]; if ( $excisedFnames ) { $this->logger->debug( "cancelAtomic: canceling level $pos ($savedFname) " . diff --git a/includes/libs/rdbms/database/domain/DatabaseDomain.php b/includes/libs/rdbms/database/domain/DatabaseDomain.php index 76a4e7d0bea..adeeab42024 100644 --- a/includes/libs/rdbms/database/domain/DatabaseDomain.php +++ b/includes/libs/rdbms/database/domain/DatabaseDomain.php @@ -92,9 +92,9 @@ class DatabaseDomain { if ( count( $parts ) == 1 ) { $database = $parts[0]; } elseif ( count( $parts ) == 2 ) { - list( $database, $prefix ) = $parts; + [ $database, $prefix ] = $parts; } elseif ( count( $parts ) == 3 ) { - list( $database, $schema, $prefix ) = $parts; + [ $database, $schema, $prefix ] = $parts; } else { throw new InvalidArgumentException( "Domain '$domain' has too few or too many parts." ); } diff --git a/includes/libs/rdbms/platform/SQLPlatform.php b/includes/libs/rdbms/platform/SQLPlatform.php index 8e587846d28..1feec5cf778 100644 --- a/includes/libs/rdbms/platform/SQLPlatform.php +++ b/includes/libs/rdbms/platform/SQLPlatform.php @@ -716,7 +716,7 @@ class SQLPlatform implements ISQLPlatform { $from = ''; } - list( $startOpts, $preLimitTail, $postLimitTail ) = $this->makeSelectOptions( $options ); + [ $startOpts, $preLimitTail, $postLimitTail ] = $this->makeSelectOptions( $options ); if ( is_array( $conds ) ) { $where = $this->makeList( $conds, self::LIST_AND ); @@ -882,7 +882,7 @@ class SQLPlatform implements ISQLPlatform { // Is there a JOIN clause for this table? if ( isset( $join_conds[$alias] ) ) { Assert::parameterType( 'array', $join_conds[$alias], "join_conds[$alias]" ); - list( $joinType, $conds ) = $join_conds[$alias]; + [ $joinType, $conds ] = $join_conds[$alias]; $tableClause = $this->normalizeJoinType( $joinType ); $tableClause .= ' ' . $joinedTable; if ( isset( $use_index[$alias] ) ) { // has USE INDEX? @@ -1032,7 +1032,7 @@ class SQLPlatform implements ISQLPlatform { } # Split database and table into proper variables. - list( $database, $schema, $prefix, $table ) = $this->qualifiedTableComponents( $name ); + [ $database, $schema, $prefix, $table ] = $this->qualifiedTableComponents( $name ); # Quote $table and apply the prefix if not quoted. # $tableName might be empty if this is called from Database::replaceVars() @@ -1066,18 +1066,18 @@ class SQLPlatform implements ISQLPlatform { $currentDomainPrefix = null; } if ( count( $dbDetails ) == 3 ) { - list( $database, $schema, $table ) = $dbDetails; + [ $database, $schema, $table ] = $dbDetails; # We don't want any prefix added in this case $prefix = ''; } elseif ( count( $dbDetails ) == 2 ) { - list( $database, $table ) = $dbDetails; + [ $database, $table ] = $dbDetails; # We don't want any prefix added in this case $prefix = ''; # In dbs that support it, $database may actually be the schema # but that doesn't affect any of the functionality here $schema = ''; } else { - list( $table ) = $dbDetails; + [ $table ] = $dbDetails; if ( isset( $this->tableAliases[$table] ) ) { $database = $this->tableAliases[$table]['dbname']; $schema = is_string( $this->tableAliases[$table]['schema'] ) @@ -1396,7 +1396,7 @@ class SQLPlatform implements ISQLPlatform { public function insertSqlText( $table, array $rows ) { $encTable = $this->tableName( $table ); - list( $sqlColumns, $sqlTuples ) = $this->makeInsertLists( $rows ); + [ $sqlColumns, $sqlTuples ] = $this->makeInsertLists( $rows ); return "INSERT INTO $encTable ($sqlColumns) VALUES $sqlTuples"; } @@ -1448,8 +1448,8 @@ class SQLPlatform implements ISQLPlatform { public function insertNonConflictingSqlText( $table, array $rows ) { $encTable = $this->tableName( $table ); - list( $sqlColumns, $sqlTuples ) = $this->makeInsertLists( $rows ); - list( $sqlVerb, $sqlOpts ) = $this->makeInsertNonConflictingVerbAndOptions(); + [ $sqlColumns, $sqlTuples ] = $this->makeInsertLists( $rows ); + [ $sqlVerb, $sqlOpts ] = $this->makeInsertNonConflictingVerbAndOptions(); return rtrim( "$sqlVerb $encTable ($sqlColumns) VALUES $sqlTuples $sqlOpts" ); } @@ -1473,7 +1473,7 @@ class SQLPlatform implements ISQLPlatform { array $selectOptions, $selectJoinConds ) { - list( $sqlVerb, $sqlOpts ) = $this->isFlagInOptions( 'IGNORE', $insertOptions ) + [ $sqlVerb, $sqlOpts ] = $this->isFlagInOptions( 'IGNORE', $insertOptions ) ? $this->makeInsertNonConflictingVerbAndOptions() : [ 'INSERT INTO', '' ]; $encDstTable = $this->tableName( $destTable ); diff --git a/includes/libs/redis/RedisConnectionPool.php b/includes/libs/redis/RedisConnectionPool.php index a289779b55d..8455315f8c0 100644 --- a/includes/libs/redis/RedisConnectionPool.php +++ b/includes/libs/redis/RedisConnectionPool.php @@ -228,10 +228,10 @@ class RedisConnectionPool implements LoggerAwareInterface { // TCP connection if ( preg_match( '/^\[(.+)\]:(\d+)$/', $server, $m ) ) { // (ip, port) - list( $host, $port ) = [ $m[1], (int)$m[2] ]; + [ $host, $port ] = [ $m[1], (int)$m[2] ]; } elseif ( preg_match( '/^((?:[\w]+\:\/\/)?[^:]+):(\d+)$/', $server, $m ) ) { // (ip, uri or path, port) - list( $host, $port ) = [ $m[1], (int)$m[2] ]; + [ $host, $port ] = [ $m[1], (int)$m[2] ]; if ( substr( $host, 0, 6 ) === 'tls://' && version_compare( phpversion( 'redis' ), '5.0.0' ) < 0 @@ -242,7 +242,7 @@ class RedisConnectionPool implements LoggerAwareInterface { } } else { // (ip or path, port) - list( $host, $port ) = [ $server, 6379 ]; + [ $host, $port ] = [ $server, 6379 ]; } } diff --git a/includes/libs/stats/BufferingStatsdDataFactory.php b/includes/libs/stats/BufferingStatsdDataFactory.php index 36f4bc10d2f..1e7ce963b9f 100644 --- a/includes/libs/stats/BufferingStatsdDataFactory.php +++ b/includes/libs/stats/BufferingStatsdDataFactory.php @@ -187,7 +187,7 @@ class BufferingStatsdDataFactory extends StatsdDataFactory implements IBuffering */ public function getData() { $data = []; - foreach ( $this->buffer as list( $key, $val, $metric ) ) { + foreach ( $this->buffer as [ $key, $val, $metric ] ) { // Optimization: Don't bother transmitting a counter update with a delta of zero if ( $metric === StatsdDataInterface::STATSD_METRIC_COUNT && !$val ) { continue; diff --git a/includes/libs/uuid/GlobalIdGenerator.php b/includes/libs/uuid/GlobalIdGenerator.php index 6a4f4b427bc..f4ae6a9c447 100644 --- a/includes/libs/uuid/GlobalIdGenerator.php +++ b/includes/libs/uuid/GlobalIdGenerator.php @@ -597,7 +597,7 @@ class GlobalIdGenerator { * @throws RuntimeException */ protected function millisecondsSinceEpochBinary( array $time ) { - list( $sec, $msec ) = $time; + [ $sec, $msec ] = $time; $ts = 1000 * $sec + $msec; if ( $ts > 2 ** 52 ) { throw new RuntimeException( __METHOD__ . @@ -614,7 +614,7 @@ class GlobalIdGenerator { * @throws RuntimeException */ protected function intervalsSinceGregorianBinary( array $time, $delta = 0 ) { - list( $sec, $msec ) = $time; + [ $sec, $msec ] = $time; $offset = '122192928000000000'; // 64 bit integers diff --git a/includes/libs/virtualrest/RestbaseVirtualRESTService.php b/includes/libs/virtualrest/RestbaseVirtualRESTService.php index ff6a5f71352..0855e056e35 100644 --- a/includes/libs/virtualrest/RestbaseVirtualRESTService.php +++ b/includes/libs/virtualrest/RestbaseVirtualRESTService.php @@ -157,14 +157,14 @@ class RestbaseVirtualRESTService extends VirtualRESTService { */ public function onParsoid3Request( array $req, Closure $idGeneratorFunc ) { $parts = explode( '/', $req['url'] ); - list( + [ $targetWiki, // 'local' $version, // 'v3' $action, // 'transform' or 'page' $format, // 'html' or 'wikitext' // $title, // optional // $revision, // optional - ) = $parts; + ] = $parts; if ( $targetWiki !== 'local' ) { throw new Exception( "Only 'local' target wiki is currently supported" ); } elseif ( $version !== 'v3' ) { diff --git a/includes/libs/virtualrest/SwiftVirtualRESTService.php b/includes/libs/virtualrest/SwiftVirtualRESTService.php index 5169bb4aac7..7de741b3589 100644 --- a/includes/libs/virtualrest/SwiftVirtualRESTService.php +++ b/includes/libs/virtualrest/SwiftVirtualRESTService.php @@ -72,7 +72,7 @@ class SwiftVirtualRESTService extends VirtualRESTService { protected function applyAuthResponse( array $req ) { $this->authSessionTimestamp = 0; - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $req['response']; + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $req['response']; if ( $rcode >= 200 && $rcode <= 299 ) { // OK $this->authCreds = [ 'auth_token' => $rhdrs['x-auth-token'], diff --git a/includes/libs/virtualrest/VirtualRESTServiceClient.php b/includes/libs/virtualrest/VirtualRESTServiceClient.php index a3d807d471f..216e5899e56 100644 --- a/includes/libs/virtualrest/VirtualRESTServiceClient.php +++ b/includes/libs/virtualrest/VirtualRESTServiceClient.php @@ -133,7 +133,7 @@ class VirtualRESTServiceClient { * - error : Any cURL error string * The map also stores integer-indexed copies of these values. This lets callers do: * @code - * list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $client->run( $req ); + * [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $client->run( $req ); * @endcode * @param array $req Virtual HTTP request maps * @return array Response array for request @@ -153,7 +153,7 @@ class VirtualRESTServiceClient { * - error : Any cURL error string * The map also stores integer-indexed copies of these values. This lets callers do: * @code - * list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $responses[0]; + * [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $responses[0]; * @endcode * * @param array[] $reqs Map of Virtual HTTP request maps @@ -192,7 +192,7 @@ class VirtualRESTServiceClient { $executeReqs[$index] = $req; } else { // Must be a virtual HTTP URL; resolve it - list( $prefix, $service ) = $this->getMountAndService( $req['url'] ); + [ $prefix, $service ] = $this->getMountAndService( $req['url'] ); if ( !$service ) { throw new UnexpectedValueException( "Path '{$req['url']}' has no service." ); } diff --git a/includes/linker/LinkRenderer.php b/includes/linker/LinkRenderer.php index 59bdd0c1516..0821cd1de9c 100644 --- a/includes/linker/LinkRenderer.php +++ b/includes/linker/LinkRenderer.php @@ -368,7 +368,7 @@ class LinkRenderer { public function normalizeTarget( $target ) { $target = $this->castToLinkTarget( $target ); if ( $target->getNamespace() === NS_SPECIAL && !$target->isExternal() ) { - list( $name, $subpage ) = $this->specialPageFactory->resolveAlias( + [ $name, $subpage ] = $this->specialPageFactory->resolveAlias( $target->getDBkey() ); if ( $name ) { diff --git a/includes/logging/DeleteLogFormatter.php b/includes/logging/DeleteLogFormatter.php index 6263c3b50d1..bb294ae39d1 100644 --- a/includes/logging/DeleteLogFormatter.php +++ b/includes/logging/DeleteLogFormatter.php @@ -83,7 +83,7 @@ class DeleteLogFormatter extends LogFormatter { $old = $this->parseBitField( $params[$paramStart + 1] ); $new = $this->parseBitField( $params[$paramStart + 2] ); - list( $hid, $unhid, $extra ) = RevisionDeleter::getChanges( $new, $old ); + [ $hid, $unhid, $extra ] = RevisionDeleter::getChanges( $new, $old ); $changes = []; // messages used: revdelete-content-hid, revdelete-summary-hid, revdelete-uname-hid foreach ( $hid as $v ) { @@ -134,7 +134,7 @@ class DeleteLogFormatter extends LogFormatter { protected function parseBitField( $string ) { // Input is like ofield=2134 or just the number if ( strpos( $string, 'field=' ) === 1 ) { - list( , $field ) = explode( '=', $string ); + [ , $field ] = explode( '=', $string ); return (int)$field; } else { diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index e42f5636b36..e58494fba4b 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -399,7 +399,7 @@ class LogEventsList extends ContextSource { $del = $this->getShowHideLinks( $row ); // Any tags... - list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( + [ $tagDisplay, $newClasses ] = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent', $this->getContext() diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index b2bbbd1e369..ce347215270 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -541,7 +541,7 @@ class LogFormatter { if ( strpos( $key, ':' ) === false ) { continue; } - list( $index, $type, ) = explode( ':', $key, 3 ); + [ $index, $type, ] = explode( ':', $key, 3 ); if ( ctype_digit( $index ) ) { $params[(int)$index - 1] = $this->formatParameterValue( $type, $value ); } diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php index 5594315e6c8..610630ecd99 100644 --- a/includes/logging/LogPager.php +++ b/includes/logging/LogPager.php @@ -266,7 +266,7 @@ class LogPager extends ReverseChronologicalPager { if ( $this->types == [ 'rights' ] ) { $parts = explode( $interwikiDelimiter, $page->getDBkey() ); if ( count( $parts ) == 2 ) { - list( $name, $database ) = array_map( 'trim', $parts ); + [ $name, $database ] = array_map( 'trim', $parts ); if ( strstr( $database, '*' ) ) { // Search for wildcard in database name $doUserRightsLogLike = true; } diff --git a/includes/media/BitmapHandler.php b/includes/media/BitmapHandler.php index 792dba3b94e..43696117ea6 100644 --- a/includes/media/BitmapHandler.php +++ b/includes/media/BitmapHandler.php @@ -240,7 +240,7 @@ class BitmapHandler extends TransformationalImageHandler { } $rotation = isset( $params['disableRotation'] ) ? 0 : $this->getRotation( $image ); - list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation ); + [ $width, $height ] = $this->extractPreRotationDimensions( $params, $rotation ); $cmd = Shell::escape( ...array_merge( [ $imageMagickConvertCommand ], @@ -307,7 +307,7 @@ class BitmapHandler extends TransformationalImageHandler { < $sharpenReductionThreshold ) { // Hack, since $wgSharpenParameter is written specifically for the command line convert - list( $radius, $sigma ) = explode( 'x', $sharpenParameter, 2 ); + [ $radius, $sigma ] = explode( 'x', $sharpenParameter, 2 ); $im->sharpenImage( (float)$radius, (float)$sigma ); } $qualityVal = isset( $params['quality'] ) ? (string)$params['quality'] : null; @@ -340,7 +340,7 @@ class BitmapHandler extends TransformationalImageHandler { } $rotation = isset( $params['disableRotation'] ) ? 0 : $this->getRotation( $image ); - list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation ); + [ $width, $height ] = $this->extractPreRotationDimensions( $params, $rotation ); $im->setImageBackgroundColor( new ImagickPixel( 'white' ) ); @@ -450,7 +450,7 @@ class BitmapHandler extends TransformationalImageHandler { return $this->getMediaTransformError( $params, $errMsg ); } - list( $loader, $colorStyle, $useQuality, $saveType ) = $typemap[$params['mimeType']]; + [ $loader, $colorStyle, $useQuality, $saveType ] = $typemap[$params['mimeType']]; if ( !function_exists( $loader ) ) { $err = "Incomplete GD library configuration: missing function $loader"; @@ -481,7 +481,7 @@ class BitmapHandler extends TransformationalImageHandler { $rotation = function_exists( 'imagerotate' ) && !isset( $params['disableRotation'] ) ? $this->getRotation( $image ) : 0; - list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation ); + [ $width, $height ] = $this->extractPreRotationDimensions( $params, $rotation ); $dst_image = imagecreatetruecolor( $width, $height ); // Initialise the destination image to transparent instead of diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php index b4e2bf012fe..bea54aca95a 100644 --- a/includes/media/DjVuImage.php +++ b/includes/media/DjVuImage.php @@ -185,7 +185,7 @@ class DjVuImage { // and report its information, hoping others are the same size. $start = ftell( $file ); do { - list( $chunk, $length ) = $this->readChunk( $file ); + [ $chunk, $length ] = $this->readChunk( $file ); if ( !$chunk ) { break; } @@ -210,7 +210,7 @@ class DjVuImage { } private function getPageInfo( $file ) { - list( $chunk, $length ) = $this->readChunk( $file ); + [ $chunk, $length ] = $this->readChunk( $file ); if ( $chunk != 'INFO' ) { wfDebug( __METHOD__ . ": expected INFO chunk, got '$chunk'" ); diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index 160c9749162..7cd763c161c 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -859,7 +859,7 @@ class FormatMetadata extends ContextSource { case 'MaxApertureValue': if ( strpos( $val, '/' ) !== false ) { // need to expand this earlier to calculate fNumber - list( $n, $d ) = explode( '/', $val, 2 ); + [ $n, $d ] = explode( '/', $val, 2 ); if ( is_numeric( $n ) && is_numeric( $d ) ) { $val = (int)$n / (int)$d; } diff --git a/includes/media/GIFMetadataExtractor.php b/includes/media/GIFMetadataExtractor.php index ed9852bab01..a3e46b6bf5a 100644 --- a/includes/media/GIFMetadataExtractor.php +++ b/includes/media/GIFMetadataExtractor.php @@ -92,7 +92,7 @@ class GIFMetadataExtractor { // Read BPP $buf = fread( $fh, 1 ); - list( $bpp, $have_map ) = self::decodeBPP( $buf ); + [ $bpp, $have_map ] = self::decodeBPP( $buf ); // Skip over background and aspect ratio // @phan-suppress-next-line PhanPluginUseReturnValueInternalKnown @@ -116,7 +116,7 @@ class GIFMetadataExtractor { # # Read BPP $buf = fread( $fh, 1 ); - list( $bpp, $have_map ) = self::decodeBPP( $buf ); + [ $bpp, $have_map ] = self::decodeBPP( $buf ); # # Read GCT if ( $have_map ) { diff --git a/includes/media/IPTC.php b/includes/media/IPTC.php index 1243a165629..fd6fcd96e31 100644 --- a/includes/media/IPTC.php +++ b/includes/media/IPTC.php @@ -346,13 +346,13 @@ class IPTC { if ( count( $date ) === 1 ) { // the standard says this should always be 1 // just double checking. - list( $date ) = self::convIPTC( $date, $charset ); + [ $date ] = self::convIPTC( $date, $charset ); } else { return null; } if ( count( $time ) === 1 ) { - list( $time ) = self::convIPTC( $time, $charset ); + [ $time ] = self::convIPTC( $time, $charset ); $dateOnly = false; } else { $time = '000000+0000'; // placeholder diff --git a/includes/media/PNGMetadataExtractor.php b/includes/media/PNGMetadataExtractor.php index 5efee62e8d8..142b5b6919f 100644 --- a/includes/media/PNGMetadataExtractor.php +++ b/includes/media/PNGMetadataExtractor.php @@ -232,7 +232,7 @@ class PNGMetadataExtractor { continue; } - list( $keyword, $content ) = explode( "\x00", $buf, 2 ); + [ $keyword, $content ] = explode( "\x00", $buf, 2 ); if ( $keyword === '' ) { wfDebug( __METHOD__ . ": Empty tEXt keyword" ); continue; @@ -264,7 +264,7 @@ class PNGMetadataExtractor { continue; } - list( $keyword, $postKeyword ) = explode( "\x00", $buf, 2 ); + [ $keyword, $postKeyword ] = explode( "\x00", $buf, 2 ); if ( $keyword === '' || $postKeyword === '' ) { wfDebug( __METHOD__ . ": Empty zTXt chunk" ); continue; diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index b6ed44d1b3c..d284dccd6a3 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -482,7 +482,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $readTime = (int)$this->getCurrentTime(); $keysByTableByShard = []; foreach ( $keys as $key ) { - list( $shardIndex, $partitionTable ) = $this->getKeyLocation( $key ); + [ $shardIndex, $partitionTable ] = $this->getKeyLocation( $key ); $keysByTableByShard[$shardIndex][$partitionTable][] = $key; } @@ -563,7 +563,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $argsByKeyByTableByShard = []; foreach ( $argsByKey as $key => $args ) { - list( $shardIndex, $partitionTable ) = $this->getKeyLocation( $key ); + [ $shardIndex, $partitionTable ] = $this->getKeyLocation( $key ); $argsByKeyByTableByShard[$shardIndex][$partitionTable][$key] = $args; } @@ -623,7 +623,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { if ( $this->multiPrimaryMode ) { // @TODO: use multi-row upsert() with VALUES() once supported in Database - foreach ( $argsByKey as $key => list( $value, $exptime ) ) { + foreach ( $argsByKey as $key => [ $value, $exptime ] ) { $serialValue = $this->getSerialized( $value, $key ); $expiry = $this->makeNewKeyExpiry( $exptime, (int)$mtime ); $db->upsert( @@ -640,7 +640,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { } else { // T288998: use REPLACE, if possible, to avoid cluttering the binlogs $rows = []; - foreach ( $argsByKey as $key => list( $value, $exptime ) ) { + foreach ( $argsByKey as $key => [ $value, $exptime ] ) { $expiry = $this->makeNewKeyExpiry( $exptime, (int)$mtime ); $serialValue = $this->getSerialized( $value, $key ); $rows[] = $this->buildUpsertRow( $db, $key, $serialValue, $expiry, $mt ); @@ -747,7 +747,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $existingByKey = array_fill_keys( $existingKeys, true ); // @TODO: use multi-row upsert() with VALUES() once supported in Database - foreach ( $argsByKey as $key => list( $value, $exptime ) ) { + foreach ( $argsByKey as $key => [ $value, $exptime ] ) { if ( isset( $existingByKey[$key] ) ) { $this->logger->debug( __METHOD__ . ": $key already exists" ); continue; @@ -815,7 +815,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { } // @TODO: use multi-row upsert() with VALUES() once supported in Database - foreach ( $argsByKey as $key => list( $value, $exptime, $casToken ) ) { + foreach ( $argsByKey as $key => [ $value, $exptime, $casToken ] ) { $curToken = $curTokensByKey[$key] ?? null; if ( $curToken === null ) { $this->logger->debug( __METHOD__ . ": $key does not exists" ); @@ -883,7 +883,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { foreach ( $res as $curRow ) { $key = $curRow->keyname; $serialValue = $this->dbDecodeSerialValue( $db, $curRow->value ); - list( $exptime ) = $argsByKey[$key]; + [ $exptime ] = $argsByKey[$key]; $expiry = $this->makeNewKeyExpiry( $exptime, (int)$mtime ); $db->upsert( @@ -897,7 +897,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { } } else { $keysBatchesByExpiry = []; - foreach ( $argsByKey as $key => list( $exptime ) ) { + foreach ( $argsByKey as $key => [ $exptime ] ) { $expiry = $this->makeNewKeyExpiry( $exptime, (int)$mtime ); $keysBatchesByExpiry[$expiry][] = $key; } @@ -948,7 +948,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { array $argsByKey, array &$resByKey ) { - foreach ( $argsByKey as $key => list( $step, $init, $exptime ) ) { + foreach ( $argsByKey as $key => [ $step, $init, $exptime ] ) { $mt = $this->makeTimestampedModificationToken( $mtime, $db ); $expiry = $this->makeNewKeyExpiry( $exptime, (int)$mtime ); @@ -1013,7 +1013,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { array $argsByKey, array &$resByKey ) { - foreach ( $argsByKey as $key => list( $step, $init, $exptime ) ) { + foreach ( $argsByKey as $key => [ $step, $init, $exptime ] ) { $mt = $this->makeTimestampedModificationToken( $mtime, $db ); $expiry = $this->makeNewKeyExpiry( $exptime, (int)$mtime ); $db->upsert( @@ -1095,7 +1095,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { // which generally has fewer than 6 digits of meaningful precision but can still be useful // in debugging (to see the token continuously change even during rapid testing). $seconds = (int)$mtime; - list( , $microseconds ) = explode( '.', sprintf( '%.6F', $mtime ) ); + [ , $microseconds ] = explode( '.', sprintf( '%.6F', $mtime ) ); $id = $db->getTopologyBasedServerId() ?? sprintf( '%u', crc32( $db->getServerName() ) ); @@ -1248,7 +1248,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { } $set = []; - foreach ( $expressionsByColumn as $column => list( $updateExpression, $initExpression ) ) { + foreach ( $expressionsByColumn as $column => [ $updateExpression, $initExpression ] ) { $rhs = $db->conditional( 'exptime >= ' . $db->addQuotes( $db->timestamp( $mtUnixTs ) ), $updateExpression, @@ -1563,7 +1563,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $lockTsUnix = null; - list( $shardIndex ) = $this->getKeyLocation( $key ); + [ $shardIndex ] = $this->getKeyLocation( $key ); try { $db = $this->getConnection( $shardIndex ); $lockTsUnix = $db->lock( $key, __METHOD__, $timeout, $db::LOCK_TIMESTAMP ); @@ -1582,7 +1582,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { /** @noinspection PhpUnusedLocalVariableInspection */ $silenceScope = $this->silenceTransactionProfiler(); - list( $shardIndex ) = $this->getKeyLocation( $key ); + [ $shardIndex ] = $this->getKeyLocation( $key ); try { $db = $this->getConnection( $shardIndex ); diff --git a/includes/page/Article.php b/includes/page/Article.php index 05ca1fbe8a1..35c02279d74 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -902,7 +902,7 @@ class Article implements Page { // Run view updates for the newer revision being diffed (and shown // below the diff if not diffOnly). - list( $old, $new ) = $de->mapDiffPrevNext( $oldid, $diff ); + [ $old, $new ] = $de->mapDiffPrevNext( $oldid, $diff ); // New can be false, convert it to 0 - this conveniently means the latest revision $this->mPage->doViewUpdates( $context->getAuthority(), (int)$new ); } diff --git a/includes/page/ImageHistoryPseudoPager.php b/includes/page/ImageHistoryPseudoPager.php index ca7cafb5d3d..d87561e67fb 100644 --- a/includes/page/ImageHistoryPseudoPager.php +++ b/includes/page/ImageHistoryPseudoPager.php @@ -71,7 +71,7 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager { // Only display 10 revisions at once by default, otherwise the list is overwhelming $this->mLimitsShown = array_merge( [ 10 ], $this->mLimitsShown ); $this->mDefaultLimit = 10; - list( $this->mLimit, /* $offset */ ) = + [ $this->mLimit, /* $offset */ ] = $this->mRequest->getLimitOffsetForUser( $this->getUser(), $this->mDefaultLimit, diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php index 4b4876d8001..9affa37f466 100644 --- a/includes/page/ImagePage.php +++ b/includes/page/ImagePage.php @@ -351,7 +351,7 @@ class ImagePage extends Article { $request = $context->getRequest(); if ( $this->displayImg->exists() ) { - list( $maxWidth, $maxHeight ) = $this->getImageLimitsFromOption( $user, 'imagesize' ); + [ $maxWidth, $maxHeight ] = $this->getImageLimitsFromOption( $user, 'imagesize' ); # image $page = $request->getIntOrNull( 'page' ); @@ -387,7 +387,7 @@ class ImagePage extends Article { $height > $maxHeight || $this->displayImg->isVectorized() ) { - list( $width, $height ) = $this->displayImg->getDisplayWidthHeight( + [ $width, $height ] = $this->displayImg->getDisplayWidthHeight( $maxWidth, $maxHeight, $page ); $linktext = $context->msg( 'show-big-image' )->escaped(); @@ -691,7 +691,7 @@ EOT $origMime = $this->displayImg->getMimeType(); $typeParams = $params; $this->displayImg->getHandler()->normaliseParams( $this->displayImg, $typeParams ); - list( $thumbExt, $thumbMime ) = $this->displayImg->getHandler()->getThumbType( + [ $thumbExt, $thumbMime ] = $this->displayImg->getHandler()->getThumbType( $origExt, $origMime, $typeParams ); if ( $thumbMime !== $origMime ) { $previewTypeDiffers = true; diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 94f0bc60fd0..12854667c35 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -464,7 +464,7 @@ class WikiPage implements Page, IDBAccessObject, PageRecord { } if ( is_int( $from ) ) { - list( $index, $opts ) = DBAccessObjectUtils::getDBOptions( $from ); + [ $index, $opts ] = DBAccessObjectUtils::getDBOptions( $from ); $loadBalancer = $this->getDBLoadBalancer(); $db = $loadBalancer->getConnectionRef( $index ); $data = $this->pageDataFromTitle( $db, $this->mTitle, $opts ); @@ -475,7 +475,7 @@ class WikiPage implements Page, IDBAccessObject, PageRecord { && $loadBalancer->hasOrMadeRecentPrimaryChanges() ) { $from = self::READ_LATEST; - list( $index, $opts ) = DBAccessObjectUtils::getDBOptions( $from ); + [ $index, $opts ] = DBAccessObjectUtils::getDBOptions( $from ); $db = $loadBalancer->getConnectionRef( $index ); $data = $this->pageDataFromTitle( $db, $this->mTitle, $opts ); } diff --git a/includes/pager/IndexPager.php b/includes/pager/IndexPager.php index 4a9f3398e01..6f805f0b1d3 100644 --- a/includes/pager/IndexPager.php +++ b/includes/pager/IndexPager.php @@ -191,7 +191,7 @@ abstract class IndexPager extends ContextSource implements Pager { ->getIntOption( $this->getUser(), 'rclimit' ); if ( !$this->mLimit ) { // Don't override if a subclass calls $this->setLimit() in its constructor. - list( $this->mLimit, /* $offset */ ) = $this->mRequest + [ $this->mLimit, /* $offset */ ] = $this->mRequest ->getLimitOffsetForUser( $this->getUser() ); } @@ -454,7 +454,7 @@ abstract class IndexPager extends ContextSource implements Pager { * @return IResultWrapper */ public function reallyDoQuery( $offset, $limit, $order ) { - list( $tables, $fields, $conds, $fname, $options, $join_conds ) = + [ $tables, $fields, $conds, $fname, $options, $join_conds ] = $this->buildQueryInfo( $offset, $limit, $order ); return $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds ); diff --git a/includes/pager/RangeChronologicalPager.php b/includes/pager/RangeChronologicalPager.php index 9b62a5755d2..9c790846b49 100644 --- a/includes/pager/RangeChronologicalPager.php +++ b/includes/pager/RangeChronologicalPager.php @@ -105,7 +105,7 @@ abstract class RangeChronologicalPager extends ReverseChronologicalPager { * @return array */ protected function buildQueryInfo( $offset, $limit, $order ) { - list( $tables, $fields, $conds, $fname, $options, $join_conds ) = parent::buildQueryInfo( + [ $tables, $fields, $conds, $fname, $options, $join_conds ] = parent::buildQueryInfo( $offset, $limit, $order diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index cd85bff0024..919822900a3 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -1077,7 +1077,7 @@ class CoreParserFunctions { } public static function special( $parser, $text ) { - list( $page, $subpage ) = MediaWikiServices::getInstance()->getSpecialPageFactory()-> + [ $page, $subpage ] = MediaWikiServices::getInstance()->getSpecialPageFactory()-> resolveAlias( $text ); if ( $page ) { $title = SpecialPage::getTitleFor( $page, $subpage ); diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index d6569609c25..c5585b4e38c 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -128,7 +128,7 @@ class LinkHolderArray { */ public function makeHolder( Title $nt, $text = '', $trail = '', $prefix = '' ) { # Separate the link trail from the rest of the link - list( $inside, $trail ) = Linker::splitTrail( $trail ); + [ $inside, $trail ] = Linker::splitTrail( $trail ); $key = $this->parent->nextLinkID(); $entry = [ @@ -438,7 +438,7 @@ class LinkHolderArray { // loop over link holders foreach ( $holderKeys as $key ) { - list( $ns, $index ) = explode( ':', $key, 2 ); + [ $ns, $index ] = explode( ':', $key, 2 ); $entry =& $this->internals[$ns][$index]; $pdbk = $entry['pdbk']; @@ -455,7 +455,7 @@ class LinkHolderArray { // check if the object is a variant of a category if ( isset( $categoryMap[$vardbk] ) ) { - list( $oldkey, $oldtitle ) = $categoryMap[$vardbk]; + [ $oldkey, $oldtitle ] = $categoryMap[$vardbk]; if ( !isset( $varCategories[$oldkey] ) && !$oldtitle->exists() ) { $varCategories[$oldkey] = $vardbk; } @@ -487,10 +487,10 @@ class LinkHolderArray { return preg_replace_callback( '//', function ( $matches ) { - list( $unchanged, $isInterwiki, $key ) = $matches; + [ $unchanged, $isInterwiki, $key ] = $matches; if ( !$isInterwiki ) { - list( $ns, $index ) = explode( ':', $key, 2 ); + [ $ns, $index ] = explode( ':', $key, 2 ); return $this->internals[$ns][$index]['text'] ?? $unchanged; } else { return $this->interwikis[$key]['text'] ?? $unchanged; diff --git a/includes/parser/PPFrame_Hash.php b/includes/parser/PPFrame_Hash.php index 4e34f9c82b8..80699972010 100644 --- a/includes/parser/PPFrame_Hash.php +++ b/includes/parser/PPFrame_Hash.php @@ -252,7 +252,7 @@ class PPFrame_Hash implements PPFrame { throw new MWException( __METHOD__ . ': found an array where a node descriptor should be' ); } - list( $contextName, $contextChildren ) = $contextNode; + [ $contextName, $contextChildren ] = $contextNode; } else { throw new MWException( __METHOD__ . ': Invalid parameter type' ); } diff --git a/includes/parser/PPNode_Hash_Tree.php b/includes/parser/PPNode_Hash_Tree.php index 26e07a28a54..d2a061c6c54 100644 --- a/includes/parser/PPNode_Hash_Tree.php +++ b/includes/parser/PPNode_Hash_Tree.php @@ -70,7 +70,7 @@ class PPNode_Hash_Tree implements PPNode { public function __construct( array $store, $index ) { $this->store = $store; $this->index = $index; - list( $this->name, $this->rawChildren ) = $this->store[$index]; + [ $this->name, $this->rawChildren ] = $this->store[$index]; } /** diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 11239fe7e65..e96575b63da 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -809,7 +809,7 @@ class Parser { [ $this->mExpensiveFunctionCount, $this->mOptions->getExpensiveParserFunctionLimit() ] ); - foreach ( $this->mStripState->getLimitReport() as list( $key, $value ) ) { + foreach ( $this->mStripState->getLimitReport() as [ $key, $value ] ) { $this->mOutput->setLimitReportData( $key, $value ); } @@ -1289,7 +1289,7 @@ class Parser { $inside = $p[5]; } else { # tag - list( , $element, $attributes, $close, $inside ) = $p; + [ , $element, $attributes, $close, $inside ] = $p; } $marker = self::MARKER_PREFIX . "-$element-" . sprintf( '%08X', $n++ ) . self::MARKER_SUFFIX; @@ -1313,7 +1313,7 @@ class Parser { $tail = ''; $text = ''; } else { - list( , $tail, $text ) = $q; + [ , $tail, $text ] = $q; } } @@ -2210,7 +2210,7 @@ class Parser { } else { # Have link text, e.g. [http://domain.tld/some.link text]s # Check for trail - list( $dtrail, $trail ) = Linker::splitTrail( $trail ); + [ $dtrail, $trail ] = Linker::splitTrail( $trail ); } // Excluding protocol-relative URLs may avoid many false positives. @@ -2514,7 +2514,7 @@ class Parser { if ( $useLinkPrefixExtension ) { // @phan-suppress-next-line PhanTypeMismatchArgumentNullableInternal $e2 is set under this condition if ( preg_match( $e2, $s, $m ) ) { - list( , $s, $prefix ) = $m; + [ , $s, $prefix ] = $m; } else { $prefix = ''; } @@ -2741,7 +2741,7 @@ class Parser { $this, $nt, $options, $descQuery ); # Fetch and register the file (file title may be different via hooks) - list( $file, $nt ) = $this->fetchFileAndTitle( $nt, $options ); + [ $file, $nt ] = $this->fetchFileAndTitle( $nt, $options ); # Cloak with NOPARSE to avoid replacement in handleExternalLinks $s .= $prefix . $this->armorLinks( Linker::makeMediaLinkFile( $nt, $file, $text ) ) . $trail; @@ -2777,7 +2777,7 @@ class Parser { * @return string HTML-wikitext mix oh yuck */ private function makeKnownLinkHolder( LinkTarget $nt, $text = '', $trail = '', $prefix = '' ) { - list( $inside, $trail ) = Linker::splitTrail( $trail ); + [ $inside, $trail ] = Linker::splitTrail( $trail ); if ( $text == '' ) { $text = htmlspecialchars( $this->titleFormatter->getPrefixedText( $nt ) ); @@ -3226,7 +3226,7 @@ class Parser { ": template inclusion denied for " . $title->getPrefixedDBkey() ); } else { - list( $text, $title ) = $this->getTemplateDom( $title ); + [ $text, $title ] = $this->getTemplateDom( $title ); if ( $text !== false ) { $found = true; $isChildObj = true; @@ -3395,7 +3395,7 @@ class Parser { } } - list( $callback, $flags ) = $this->mFunctionHooks[$function]; + [ $callback, $flags ] = $this->mFunctionHooks[$function]; $allArgs = [ $this ]; if ( $flags & self::SFH_OBJECT_ARGS ) { @@ -3476,7 +3476,7 @@ class Parser { $titleKey = CacheKeyHelper::getKeyForPage( $title ); if ( isset( $this->mTplRedirCache[$titleKey] ) ) { - list( $ns, $dbk ) = $this->mTplRedirCache[$titleKey]; + [ $ns, $dbk ] = $this->mTplRedirCache[$titleKey]; $title = Title::makeTitle( $ns, $dbk ); $titleKey = CacheKeyHelper::getKeyForPage( $title ); } @@ -3485,7 +3485,7 @@ class Parser { } # Cache miss, go to the database - list( $text, $title ) = $this->fetchTemplateAndTitle( $title ); + [ $text, $title ] = $this->fetchTemplateAndTitle( $title ); if ( $text === false ) { $this->mTplDomCache[$titleKey] = false; @@ -4237,7 +4237,7 @@ class Parser { $markerMatches = []; if ( preg_match( "/^$markerRegex/", $headline, $markerMatches ) ) { $serial = (int)$markerMatches[1]; - list( $titleText, $sectionIndex ) = $this->mHeadings[$serial]; + [ $titleText, $sectionIndex ] = $this->mHeadings[$serial]; $isTemplate = ( $titleText != $baseTitleText ); $headline = preg_replace( "/^$markerRegex\\s*/", "", $headline ); } @@ -5209,7 +5209,7 @@ class Parser { ); foreach ( $parameterMatches as $parameterMatch ) { - list( $magicName, $match ) = $mwArray->matchVariableStartToEnd( $parameterMatch ); + [ $magicName, $match ] = $mwArray->matchVariableStartToEnd( $parameterMatch ); if ( !$magicName ) { // Last pipe wins. $label = $parameterMatch; @@ -5229,7 +5229,7 @@ class Parser { // invoked on an external link. $linkValue = substr( $linkValue, 4, -2 ); } - list( $type, $target ) = $this->parseLinkParameter( $linkValue ); + [ $type, $target ] = $this->parseLinkParameter( $linkValue ); if ( $type ) { if ( $type === 'no-link' ) { $target = true; @@ -5373,12 +5373,12 @@ class Parser { $this, $title, $options, $descQuery ); # Fetch and register the file (file title may be different via hooks) - list( $file, $link ) = $this->fetchFileAndTitle( $link, $options ); + [ $file, $link ] = $this->fetchFileAndTitle( $link, $options ); # Get parameter map $handler = $file ? $file->getHandler() : false; - list( $paramMap, $mwArray ) = $this->getImageParams( $handler ); + [ $paramMap, $mwArray ] = $this->getImageParams( $handler ); if ( !$file ) { $this->addTrackingCategory( 'broken-file-category' ); @@ -5391,10 +5391,10 @@ class Parser { $seenformat = false; foreach ( $parts as $part ) { $part = trim( $part ); - list( $magicName, $value ) = $mwArray->matchVariableStartToEnd( $part ); + [ $magicName, $value ] = $mwArray->matchVariableStartToEnd( $part ); $validated = false; if ( isset( $paramMap[$magicName] ) ) { - list( $type, $paramName ) = $paramMap[$magicName]; + [ $type, $paramName ] = $paramMap[$magicName]; # Special case; width and height come in one variable together if ( $type === 'handler' && $paramName === 'width' ) { @@ -5434,7 +5434,7 @@ class Parser { $value = $this->stripAltText( $value, $holders ); break; case 'link': - list( $paramName, $value ) = + [ $paramName, $value ] = $this->parseLinkParameter( $this->stripAltText( $value, $holders ) ); diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index b3fde564564..d26a1a4a816 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -1853,7 +1853,7 @@ class ParserOutput extends CacheTime implements ContentMetadataCollector { } if ( strpos( $key, '-' ) ) { - list( $ns, $name ) = explode( '-', $key, 2 ); + [ $ns, $name ] = explode( '-', $key, 2 ); $this->mLimitReportJSData[$ns][$name] = $data; } else { $this->mLimitReportJSData[$key] = $data; diff --git a/includes/parser/Sanitizer.php b/includes/parser/Sanitizer.php index 533b6ba9087..d780f010f0f 100644 --- a/includes/parser/Sanitizer.php +++ b/includes/parser/Sanitizer.php @@ -330,7 +330,7 @@ class Sanitizer { # this might be possible using remex tidy itself foreach ( $bits as $x ) { if ( preg_match( self::ELEMENT_BITS_REGEX, $x, $regs ) ) { - list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs; + [ /* $qbar */, $slash, $t, $params, $brace, $rest ] = $regs; $badtag = false; $t = strtolower( $t ); @@ -1769,7 +1769,7 @@ class Sanitizer { # Validate hostname portion $matches = []; if ( preg_match( '!^([^:]+:)(//[^/]+)?(.*)$!iD', $url, $matches ) ) { - list( /* $whole */, $protocol, $host, $rest ) = $matches; + [ /* $whole */, $protocol, $host, $rest ] = $matches; // Characters that will be ignored in IDNs. // https://datatracker.ietf.org/doc/html/rfc8264#section-9.13 diff --git a/includes/password/Argon2Password.php b/includes/password/Argon2Password.php index 12da31f6fe2..dc05ce781aa 100644 --- a/includes/password/Argon2Password.php +++ b/includes/password/Argon2Password.php @@ -72,7 +72,7 @@ class Argon2Password extends Password { * @inheritDoc */ public function crypt( string $password ): void { - list( $algo, $params ) = $this->prepareParams(); + [ $algo, $params ] = $this->prepareParams(); $this->hash = password_hash( $password, $algo, $params ); } @@ -96,7 +96,7 @@ class Argon2Password extends Password { * @inheritDoc */ public function needsUpdate(): bool { - list( $algo, $params ) = $this->prepareParams(); + [ $algo, $params ] = $this->prepareParams(); return password_needs_rehash( $this->hash, $algo, $params ); } } diff --git a/includes/preferences/SignatureValidator.php b/includes/preferences/SignatureValidator.php index a9b00b508c9..e9d901655e1 100644 --- a/includes/preferences/SignatureValidator.php +++ b/includes/preferences/SignatureValidator.php @@ -315,7 +315,7 @@ class SignatureValidator { // the "subpage parameter" are not normalized for us. $splinks = $pout->getLinksSpecial(); foreach ( $splinks as $dbkey => $unused ) { - list( $name, $subpage ) = $this->specialPageFactory->resolveAlias( $dbkey ); + [ $name, $subpage ] = $this->specialPageFactory->resolveAlias( $dbkey ); if ( $name === 'Contributions' && $subpage ) { $userTitle = $this->titleFactory->makeTitleSafe( NS_USER, $subpage ); if ( $userTitle && $userTitle->getText() === $username ) { diff --git a/includes/profiler/SectionProfiler.php b/includes/profiler/SectionProfiler.php index 32d827d859d..26c42543321 100644 --- a/includes/profiler/SectionProfiler.php +++ b/includes/profiler/SectionProfiler.php @@ -238,7 +238,7 @@ class SectionProfiler { $this->logger->error( "Profiling error: $functionname" ); return; } - list( $ofname, /* $ocount */, $ortime, $octime, $omem ) = $item; + [ $ofname, /* $ocount */, $ortime, $octime, $omem ] = $item; if ( $functionname === 'close' ) { $message = "Profile section ended by close(): {$ofname}"; diff --git a/includes/revisiondelete/RevDelLogItem.php b/includes/revisiondelete/RevDelLogItem.php index 2f1a903c63d..0d4ffc3092b 100644 --- a/includes/revisiondelete/RevDelLogItem.php +++ b/includes/revisiondelete/RevDelLogItem.php @@ -141,7 +141,7 @@ class RevDelLogItem extends RevDelItem { $content = "$loglink $date $action $comment"; $attribs = []; if ( $this->row->ts_tags ) { - list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( + [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow( $this->row->ts_tags, 'revisiondelete', $this->list->getContext() diff --git a/includes/revisiondelete/RevDelRevisionItem.php b/includes/revisiondelete/RevDelRevisionItem.php index ae0e68e103f..e97890682e6 100644 --- a/includes/revisiondelete/RevDelRevisionItem.php +++ b/includes/revisiondelete/RevDelRevisionItem.php @@ -206,7 +206,7 @@ class RevDelRevisionItem extends RevDelItem { $attribs = []; $tags = $this->getTags(); if ( $tags ) { - list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( + [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow( $tags, 'revisiondelete', $this->list->getContext() diff --git a/includes/search/PrefixSearch.php b/includes/search/PrefixSearch.php index c7597e2fa17..16e7bd1a675 100644 --- a/includes/search/PrefixSearch.php +++ b/includes/search/PrefixSearch.php @@ -48,7 +48,7 @@ abstract class PrefixSearch { $hasNamespace = SearchEngine::parseNamespacePrefixes( $search, false, true ); if ( $hasNamespace !== false ) { - list( $search, $namespaces ) = $hasNamespace; + [ $search, $namespaces ] = $hasNamespace; } return $this->searchBackend( $namespaces, $search, $limit, $offset ); diff --git a/includes/search/SearchMySQL.php b/includes/search/SearchMySQL.php index 0f865aa6d85..61c3ac31616 100644 --- a/includes/search/SearchMySQL.php +++ b/includes/search/SearchMySQL.php @@ -60,7 +60,7 @@ class SearchMySQL extends SearchDatabase { $langConverter = $services->getLanguageConverterFactory()->getLanguageConverter( $contLang ); foreach ( $m as $bits ) { AtEase::suppressWarnings(); - list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits; + [ /* all */, $modifier, $term, $nonQuoted, $wildcard ] = $bits; AtEase::restoreWarnings(); if ( $nonQuoted != '' ) { diff --git a/includes/search/SearchSqlite.php b/includes/search/SearchSqlite.php index 4758572f377..c6f9e8f141d 100644 --- a/includes/search/SearchSqlite.php +++ b/includes/search/SearchSqlite.php @@ -63,7 +63,7 @@ class SearchSqlite extends SearchDatabase { $filteredText, $m, PREG_SET_ORDER ) ) { foreach ( $m as $bits ) { AtEase::suppressWarnings(); - list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits; + [ /* all */, $modifier, $term, $nonQuoted, $wildcard ] = $bits; AtEase::restoreWarnings(); if ( $nonQuoted != '' ) { diff --git a/includes/search/searchwidgets/FullSearchResultWidget.php b/includes/search/searchwidgets/FullSearchResultWidget.php index ce4ecd47fc1..cad08823e81 100644 --- a/includes/search/searchwidgets/FullSearchResultWidget.php +++ b/includes/search/searchwidgets/FullSearchResultWidget.php @@ -91,7 +91,7 @@ class FullSearchResultWidget implements SearchResultWidget { $this->specialPage->getUser() ) ); - list( $file, $desc, $thumb ) = $this->generateFileHtml( $result ); + [ $file, $desc, $thumb ] = $this->generateFileHtml( $result ); $snippet = $result->getTextSnippet(); if ( $snippet ) { $snippetWithEllipsis = $snippet . $this->specialPage->msg( 'ellipsis' ); diff --git a/includes/session/CookieSessionProvider.php b/includes/session/CookieSessionProvider.php index 785b77cc9ef..3d184daefd0 100644 --- a/includes/session/CookieSessionProvider.php +++ b/includes/session/CookieSessionProvider.php @@ -125,7 +125,7 @@ class CookieSessionProvider extends SessionProvider { $info['persisted'] = true; } - list( $userId, $userName, $token ) = $this->getUserInfoFromCookies( $request ); + [ $userId, $userName, $token ] = $this->getUserInfoFromCookies( $request ); if ( $userId !== null ) { try { $userInfo = UserInfo::newFromId( $userId ); diff --git a/includes/session/Session.php b/includes/session/Session.php index a7470cc93f0..559648a3713 100644 --- a/includes/session/Session.php +++ b/includes/session/Session.php @@ -482,7 +482,7 @@ class Session implements \Countable, \Iterator, \ArrayAccess { * @param mixed $value */ public function setSecret( $key, $value ) { - list( $encKey, $hmacKey ) = $this->getSecretKeys(); + [ $encKey, $hmacKey ] = $this->getSecretKeys(); $serialized = serialize( $value ); // The code for encryption (with OpenSSL) and sealing is taken from @@ -541,8 +541,8 @@ class Session implements \Countable, \Iterator, \ArrayAccess { $this->logger->warning( $ex->getMessage(), [ 'exception' => $ex ] ); return $default; } - list( $hmac, $iv, $ciphertext ) = $pieces; - list( $encKey, $hmacKey ) = $this->getSecretKeys(); + [ $hmac, $iv, $ciphertext ] = $pieces; + [ $encKey, $hmacKey ] = $this->getSecretKeys(); $integCalc = hash_hmac( 'sha256', $iv . '.' . $ciphertext, $hmacKey, true ); if ( !hash_equals( $integCalc, base64_decode( $hmac ) ) ) { $ex = new \Exception( 'Sealed secret has been tampered with, aborting.' ); diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index 07a89266283..5d327e011c5 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -557,7 +557,7 @@ abstract class Skin extends ContextSource { if ( $title->isSpecialPage() ) { $type = 'ns-special'; // T25315: provide a class based on the canonical special page name without subpages - list( $canonicalName ) = $services->getSpecialPageFactory()->resolveAlias( $title->getDBkey() ); + [ $canonicalName ] = $services->getSpecialPageFactory()->resolveAlias( $title->getDBkey() ); if ( $canonicalName ) { $type .= ' ' . Sanitizer::escapeClass( "mw-special-$canonicalName" ); } else { diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index 6dbeb8c1040..82012c06a8b 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -458,7 +458,7 @@ class SkinTemplate extends Skin { # so it doesn't contain the original alias-with-subpage. $origTitle = Title::newFromText( $request->getText( 'title' ) ); if ( $origTitle instanceof Title && $origTitle->isSpecialPage() ) { - list( $spName, $spPar ) = + [ $spName, $spPar ] = MediaWikiServices::getInstance()->getSpecialPageFactory()-> resolveAlias( $origTitle->getText() ); $active = $spName == 'Contributions' diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index 808d43df514..9811d4509a3 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -650,7 +650,7 @@ abstract class QueryPage extends SpecialPage { * @return int[] list( $limit, $offset ) */ protected function getLimitOffset() { - list( $limit, $offset ) = $this->getRequest() + [ $limit, $offset ] = $this->getRequest() ->getLimitOffsetForUser( $this->getUser() ); if ( $this->getConfig()->get( MainConfigNames::MiserMode ) ) { $maxResults = $this->getMaxResults(); @@ -717,7 +717,7 @@ abstract class QueryPage extends SpecialPage { $out->setSyndicated( $this->isSyndicated() ); if ( $this->limit == 0 && $this->offset == 0 ) { - list( $this->limit, $this->offset ) = $this->getLimitOffset(); + [ $this->limit, $this->offset ] = $this->getLimitOffset(); } $dbLimit = $this->getDBLimit( $this->limit, $this->offset ); // @todo Use doQuery() diff --git a/includes/specialpage/SpecialPageFactory.php b/includes/specialpage/SpecialPageFactory.php index 41f178495be..fece6a83e53 100644 --- a/includes/specialpage/SpecialPageFactory.php +++ b/includes/specialpage/SpecialPageFactory.php @@ -1275,7 +1275,7 @@ class SpecialPageFactory { * @return bool True if a special page exists with this name */ public function exists( $name ) { - list( $title, /*...*/ ) = $this->resolveAlias( $name ); + [ $title, /*...*/ ] = $this->resolveAlias( $name ); $specialPageList = $this->getPageList(); return isset( $specialPageList[$title] ); @@ -1288,7 +1288,7 @@ class SpecialPageFactory { * @return SpecialPage|null SpecialPage object or null if the page doesn't exist */ public function getPage( $name ) { - list( $realName, /*...*/ ) = $this->resolveAlias( $name ); + [ $realName, /*...*/ ] = $this->resolveAlias( $name ); $specialPageList = $this->getPageList(); @@ -1591,7 +1591,7 @@ class SpecialPageFactory { * @return Title|null Title or null if there is no such alias */ public function getTitleForAlias( $alias ) { - list( $name, $subpage ) = $this->resolveAlias( $alias ); + [ $name, $subpage ] = $this->resolveAlias( $alias ); if ( $name != null ) { return SpecialPage::getTitleFor( $name, $subpage ); } diff --git a/includes/specials/SpecialAllPages.php b/includes/specials/SpecialAllPages.php index e0c9e33f23c..46d26ff318d 100644 --- a/includes/specials/SpecialAllPages.php +++ b/includes/specials/SpecialAllPages.php @@ -210,8 +210,8 @@ class SpecialAllPages extends IncludableSpecialPage { $out = $this->msg( 'allpages-bad-ns', $namespace )->parse(); $namespace = NS_MAIN; } else { - list( $namespace, $fromKey, $from ) = $fromList; - list( , $toKey, $to ) = $toList; + [ $namespace, $fromKey, $from ] = $fromList; + [ , $toKey, $to ] = $toList; $dbr = $this->loadBalancer->getConnectionRef( ILoadBalancer::DB_REPLICA ); $filterConds = [ 'page_namespace' => $namespace ]; diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index 6ff70f9d12c..926f8ac66fe 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -167,14 +167,14 @@ class SpecialBlock extends FormSpecialPage { # need to extract *every* variable from the form just for processing here, but # there are legitimate uses for some variables $request = $this->getRequest(); - list( $this->target, $this->type ) = self::getTargetAndType( $par, $request ); + [ $this->target, $this->type ] = self::getTargetAndType( $par, $request ); if ( $this->target instanceof UserIdentity ) { # Set the 'relevant user' in the skin, so it displays links like Contributions, # User logs, UserRights, etc. $this->getSkin()->setRelevantUser( $this->target ); } - list( $this->previousTarget, /*...*/ ) = $this->blockUtils + [ $this->previousTarget, /*...*/ ] = $this->blockUtils ->parseBlockTarget( $request->getVal( 'wpPreviousTarget' ) ); $this->requestedHideUser = $request->getBool( 'wpHideUser' ); } @@ -817,7 +817,7 @@ class SpecialBlock extends FormSpecialPage { } /** @var User $target */ - list( $target, $type ) = $blockUtils->parseBlockTarget( $data['Target'] ); + [ $target, $type ] = $blockUtils->parseBlockTarget( $data['Target'] ); if ( $type == DatabaseBlock::TYPE_USER ) { $user = $target; $target = $user->getName(); diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index 56d31d02005..d4ab47f9aa7 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -185,7 +185,7 @@ class SpecialBlockList extends SpecialPage { } if ( $this->target !== '' ) { - list( $target, $type ) = $this->blockUtils->parseBlockTarget( $this->target ); + [ $target, $type ] = $this->blockUtils->parseBlockTarget( $this->target ); switch ( $type ) { case DatabaseBlock::TYPE_ID: @@ -195,7 +195,7 @@ class SpecialBlockList extends SpecialPage { case DatabaseBlock::TYPE_IP: case DatabaseBlock::TYPE_RANGE: - list( $start, $end ) = IPUtils::parseRange( $target ); + [ $start, $end ] = IPUtils::parseRange( $target ); $conds[] = $db->makeList( [ 'ipb_address' => $target, diff --git a/includes/specials/SpecialEmailUser.php b/includes/specials/SpecialEmailUser.php index 67807838c45..8bd61efd6d8 100644 --- a/includes/specials/SpecialEmailUser.php +++ b/includes/specials/SpecialEmailUser.php @@ -164,7 +164,7 @@ class SpecialEmailUser extends UnlistedSpecialPage { throw new ErrorPageError( $error, "{$error}text" ); default: # It's a hook error - list( $title, $msg, $params ) = $error; + [ $title, $msg, $params ] = $error; throw new ErrorPageError( $title, $msg, $params ); } diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index f7f0a970cfc..6242fc4cb89 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -504,7 +504,7 @@ class SpecialExport extends SpecialPage { * @return array Associative array index by titles */ protected function getTemplates( $inputPages, $pageSet ) { - list( $nsField, $titleField ) = $this->linksMigration->getTitleFields( 'templatelinks' ); + [ $nsField, $titleField ] = $this->linksMigration->getTitleFields( 'templatelinks' ); $queryInfo = $this->linksMigration->getQueryInfo( 'templatelinks' ); return $this->getLinks( $inputPages, $pageSet, $queryInfo['tables'], diff --git a/includes/specials/SpecialLonelyPages.php b/includes/specials/SpecialLonelyPages.php index 7bdc5ba5077..7f288f97ff0 100644 --- a/includes/specials/SpecialLonelyPages.php +++ b/includes/specials/SpecialLonelyPages.php @@ -84,7 +84,7 @@ class SpecialLonelyPages extends PageQueryPage { 'templatelinks', 'LEFT JOIN' ); - list( $ns, $title ) = $this->linksMigration->getTitleFields( 'templatelinks' ); + [ $ns, $title ] = $this->linksMigration->getTitleFields( 'templatelinks' ); $tables = array_merge( [ 'page', 'pagelinks' ], $queryInfo['tables'] ); $conds = [ 'pl_namespace IS NULL', diff --git a/includes/specials/SpecialMIMESearch.php b/includes/specials/SpecialMIMESearch.php index 61e9021f4c1..bd2aae552a9 100644 --- a/includes/specials/SpecialMIMESearch.php +++ b/includes/specials/SpecialMIMESearch.php @@ -184,7 +184,7 @@ class SpecialMIMESearch extends QueryPage { $this->addHelpLink( 'Help:Managing_files' ); $this->mime = $par ?: $this->getRequest()->getText( 'mime' ); $this->mime = trim( $this->mime ); - list( $this->major, $this->minor ) = File::splitMime( $this->mime ); + [ $this->major, $this->minor ] = File::splitMime( $this->mime ); if ( $this->major == '' || $this->minor == '' || $this->minor == 'unknown' || !self::isValidType( $this->major ) diff --git a/includes/specials/SpecialMediaStatistics.php b/includes/specials/SpecialMediaStatistics.php index 97db7ec8301..a245d2e1cd5 100644 --- a/includes/specials/SpecialMediaStatistics.php +++ b/includes/specials/SpecialMediaStatistics.php @@ -150,7 +150,7 @@ class SpecialMediaStatistics extends QueryPage { if ( count( $mediaStats ) < 4 ) { continue; } - list( $mediaType, $mime, $totalCount, $totalBytes ) = $mediaStats; + [ $mediaType, $mime, $totalCount, $totalBytes ] = $mediaStats; if ( $prevMediaType !== $mediaType ) { if ( $prevMediaType !== null ) { // We're not at beginning, so we have to diff --git a/includes/specials/SpecialMergeHistory.php b/includes/specials/SpecialMergeHistory.php index ae6e33d7e10..f7bd592546f 100644 --- a/includes/specials/SpecialMergeHistory.php +++ b/includes/specials/SpecialMergeHistory.php @@ -360,7 +360,7 @@ class SpecialMergeHistory extends SpecialPage { $comment = Linker::revComment( $revRecord ); // Tags, if any. - list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( + [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow( $row->ts_tags, 'mergehistory', $this->getContext() diff --git a/includes/specials/SpecialMostLinkedTemplates.php b/includes/specials/SpecialMostLinkedTemplates.php index b2bf9ef5779..ac3c3d67dd2 100644 --- a/includes/specials/SpecialMostLinkedTemplates.php +++ b/includes/specials/SpecialMostLinkedTemplates.php @@ -84,7 +84,7 @@ class SpecialMostLinkedTemplates extends QueryPage { public function getQueryInfo() { $queryInfo = $this->linksMigration->getQueryInfo( 'templatelinks' ); - list( $ns, $title ) = $this->linksMigration->getTitleFields( 'templatelinks' ); + [ $ns, $title ] = $this->linksMigration->getTitleFields( 'templatelinks' ); return [ 'tables' => $queryInfo['tables'], 'fields' => [ diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index 59687e22652..1f4a3fd6928 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -483,7 +483,7 @@ class SpecialNewpages extends IncludableSpecialPage { # Tags, if any. if ( isset( $result->ts_tags ) ) { - list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( + [ $tagDisplay, $newClasses ] = ChangeTags::formatSummaryRow( $result->ts_tags, 'newpages', $this->getContext() diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index ebe1ecd01e0..d97a0830149 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -174,8 +174,8 @@ class SpecialPrefixindex extends SpecialAllPages { $out = $this->msg( 'allpages-bad-ns', $namespace )->parse(); $namespace = NS_MAIN; } else { - list( $namespace, $prefixKey, $prefix ) = $prefixList; - list( /* $fromNS */, $fromKey, ) = $fromList; + [ $namespace, $prefixKey, $prefix ] = $prefixList; + [ /* $fromNS */, $fromKey, ] = $fromList; # ## @todo FIXME: Should complain if $fromNs != $namespace diff --git a/includes/specials/SpecialRandomInCategory.php b/includes/specials/SpecialRandomInCategory.php index a338e701a87..5e427e97306 100644 --- a/includes/specials/SpecialRandomInCategory.php +++ b/includes/specials/SpecialRandomInCategory.php @@ -255,7 +255,7 @@ class SpecialRandomInCategory extends FormSpecialPage { } if ( !$this->minTimestamp || !$this->maxTimestamp ) { try { - list( $this->minTimestamp, $this->maxTimestamp ) = $this->getMinAndMaxForCat( $this->category ); + [ $this->minTimestamp, $this->maxTimestamp ] = $this->getMinAndMaxForCat( $this->category ); } catch ( TimeoutException $e ) { throw $e; } catch ( Exception $e ) { diff --git a/includes/specials/SpecialRecentChangesLinked.php b/includes/specials/SpecialRecentChangesLinked.php index ca2266ee3be..2a5181d1861 100644 --- a/includes/specials/SpecialRecentChangesLinked.php +++ b/includes/specials/SpecialRecentChangesLinked.php @@ -237,7 +237,7 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges { // TODO: Move this to LinksMigration if ( isset( $linksMigration::$mapping[$link_table] ) ) { $queryInfo = $linksMigration->getQueryInfo( $link_table, $link_table ); - list( $nsField, $titleField ) = $linksMigration->getTitleFields( $link_table ); + [ $nsField, $titleField ] = $linksMigration->getTitleFields( $link_table ); if ( in_array( 'linktarget', $queryInfo['tables'] ) ) { $joinTable = 'linktarget'; } else { diff --git a/includes/specials/SpecialRedirect.php b/includes/specials/SpecialRedirect.php index d47e937ab9d..48068cfe3b4 100644 --- a/includes/specials/SpecialRedirect.php +++ b/includes/specials/SpecialRedirect.php @@ -253,7 +253,7 @@ class SpecialRedirect extends FormSpecialPage { // so varnish cache. $value = $status->getValue(); if ( is_array( $value ) ) { - list( $url, $code ) = $value; + [ $url, $code ] = $value; } else { $url = $value; $code = 301; diff --git a/includes/specials/SpecialRevisionDelete.php b/includes/specials/SpecialRevisionDelete.php index 6cf0a2181a3..8207ad1496b 100644 --- a/includes/specials/SpecialRevisionDelete.php +++ b/includes/specials/SpecialRevisionDelete.php @@ -578,7 +578,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { foreach ( $this->checks as $item ) { // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name, // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted - list( $message, $name, $field ) = $item; + [ $message, $name, $field ] = $item; $innerHTML = Xml::checkLabel( $this->msg( $message )->text(), $name, @@ -606,7 +606,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { foreach ( $this->checks as $item ) { // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name, // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted - list( $message, $name, $field ) = $item; + [ $message, $name, $field ] = $item; // If there are several items, use third state by default... if ( $this->submitClicked ) { $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ ); @@ -717,7 +717,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { protected function extractBitParams() { $bitfield = []; foreach ( $this->checks as $item ) { - list( /* message */, $name, $field ) = $item; + [ /* message */, $name, $field ] = $item; $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ ); if ( $val < -1 || $val > 1 ) { $val = -1; // -1 for existing value diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index ed939046996..d8e97e5b313 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -278,7 +278,7 @@ class SpecialSearch extends SpecialPage { $request = $this->getRequest(); $this->searchEngineType = $request->getVal( 'srbackend' ); - list( $this->limit, $this->offset ) = $request->getLimitOffsetForUser( + [ $this->limit, $this->offset ] = $request->getLimitOffsetForUser( $this->getUser(), 20, 'searchlimit' @@ -517,7 +517,7 @@ class SpecialSearch extends SpecialPage { } else { $textStatus->merge( $this->loadStatus ); } - list( $error, $warning ) = $textStatus->splitByErrorType(); + [ $error, $warning ] = $textStatus->splitByErrorType(); if ( $error->getErrors() ) { $out->addHTML( Html::errorBox( $error->getHTML( 'search-error' ) diff --git a/includes/specials/SpecialSpecialpages.php b/includes/specials/SpecialSpecialpages.php index 72a24b86dd5..e51650a1ff6 100644 --- a/includes/specials/SpecialSpecialpages.php +++ b/includes/specials/SpecialSpecialpages.php @@ -95,7 +95,7 @@ class SpecialSpecialpages extends UnlistedSpecialPage { foreach ( $groups as $group => $sortedPages ) { if ( strpos( $group, '/' ) !== false ) { - list( $group, $subGroup ) = explode( '/', $group, 2 ); + [ $group, $subGroup ] = explode( '/', $group, 2 ); $out->wrapWikiMsg( "

$1

\n", "specialpages-group-$group-$subGroup" diff --git a/includes/specials/SpecialUnblock.php b/includes/specials/SpecialUnblock.php index 55740167b33..64e81290259 100644 --- a/includes/specials/SpecialUnblock.php +++ b/includes/specials/SpecialUnblock.php @@ -82,7 +82,7 @@ class SpecialUnblock extends SpecialPage { $this->checkPermissions(); $this->checkReadOnly(); - list( $this->target, $this->type ) = $this->getTargetAndType( $par, $this->getRequest() ); + [ $this->target, $this->type ] = $this->getTargetAndType( $par, $this->getRequest() ); $this->block = DatabaseBlock::newFromTarget( $this->target ); if ( $this->target instanceof UserIdentity ) { # Set the 'relevant user' in the skin, so it displays links like Contributions, diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index d46d4003a5e..827d983029e 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -1191,7 +1191,7 @@ class SpecialUndelete extends SpecialPage { // Tags $attribs = []; - list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( + [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow( $row->ts_tags, 'deletedhistory', $this->getContext() diff --git a/includes/specials/SpecialUnusedTemplates.php b/includes/specials/SpecialUnusedTemplates.php index 347d8070bdc..3f1b924e32c 100644 --- a/includes/specials/SpecialUnusedTemplates.php +++ b/includes/specials/SpecialUnusedTemplates.php @@ -72,7 +72,7 @@ class SpecialUnusedTemplates extends QueryPage { 'templatelinks', 'LEFT JOIN' ); - list( $ns, $title ) = $this->linksMigration->getTitleFields( 'templatelinks' ); + [ $ns, $title ] = $this->linksMigration->getTitleFields( 'templatelinks' ); $joinConds = []; $templatelinksJoin = [ 'LEFT JOIN', [ "$title = page_title", diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index fe4a9312cdc..83bbe15c69d 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -559,7 +559,7 @@ class UserrightsPage extends SpecialPage { $name = trim( $username ); $dbDomain = ''; } else { - list( $name, $dbDomain ) = array_map( 'trim', $parts ); + [ $name, $dbDomain ] = array_map( 'trim', $parts ); if ( WikiMap::isCurrentWikiId( $dbDomain ) ) { $dbDomain = ''; @@ -762,7 +762,7 @@ class UserrightsPage extends SpecialPage { $flags ); - list( $groupCheckboxes, $canChangeAny ) = + [ $groupCheckboxes, $canChangeAny ] = $this->groupCheckboxes( $groupMemberships, $user ); $this->getOutput()->addHTML( Xml::openElement( diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index c523c26204e..00681c04b27 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -820,7 +820,7 @@ class SpecialVersion extends SpecialPage { $memcKey = $cache->makeKey( 'specialversion-ext-version-text', $extension['path'], $this->coreId ); - list( $vcsVersion, $vcsLink, $vcsDate ) = $cache->get( $memcKey ); + [ $vcsVersion, $vcsLink, $vcsDate ] = $cache->get( $memcKey ); if ( !$vcsVersion ) { wfDebug( "Getting VCS info for extension {$extension['name']}" ); diff --git a/includes/specials/SpecialWantedTemplates.php b/includes/specials/SpecialWantedTemplates.php index 6a758bd4315..c50a9de7da2 100644 --- a/includes/specials/SpecialWantedTemplates.php +++ b/includes/specials/SpecialWantedTemplates.php @@ -58,7 +58,7 @@ class SpecialWantedTemplates extends WantedQueryPage { public function getQueryInfo() { $queryInfo = $this->linksMigration->getQueryInfo( 'templatelinks' ); - list( $ns, $title ) = $this->linksMigration->getTitleFields( 'templatelinks' ); + [ $ns, $title ] = $this->linksMigration->getTitleFields( 'templatelinks' ); return [ 'tables' => array_merge( $queryInfo['tables'], [ 'page' ] ), 'fields' => [ diff --git a/includes/specials/formfields/Licenses.php b/includes/specials/formfields/Licenses.php index 1e5f2596480..20c5b16b759 100644 --- a/includes/specials/formfields/Licenses.php +++ b/includes/specials/formfields/Licenses.php @@ -98,7 +98,7 @@ class Licenses extends HTMLFormField { if ( strpos( $line, '*' ) !== 0 ) { continue; } - list( $level, $line ) = $this->trimStars( $line ); + [ $level, $line ] = $this->trimStars( $line ); if ( strpos( $line, '|' ) !== false ) { $obj = $this->buildLine( $line ); diff --git a/includes/specials/helpers/License.php b/includes/specials/helpers/License.php index fbd801d06e5..f98d040a1a0 100644 --- a/includes/specials/helpers/License.php +++ b/includes/specials/helpers/License.php @@ -39,7 +39,7 @@ class License { */ public function __construct( $str ) { $str = $this->parse( $str ); - list( $this->template, $this->text ) = $this->split( $str ); + [ $this->template, $this->text ] = $this->split( $str ); } /** @@ -55,7 +55,7 @@ class License { * @return string[] Array with [template, text] */ protected function split( $str ) { - list( $text, $template ) = explode( '|', strrev( $str ), 2 ); + [ $text, $template ] = explode( '|', strrev( $str ), 2 ); return [ strrev( $template ), strrev( $text ) ]; } } diff --git a/includes/specials/pagers/BlockListPager.php b/includes/specials/pagers/BlockListPager.php index da44e669529..f76d8a3f970 100644 --- a/includes/specials/pagers/BlockListPager.php +++ b/includes/specials/pagers/BlockListPager.php @@ -179,7 +179,7 @@ class BlockListPager extends TablePager { if ( $row->ipb_auto ) { $formatted = $this->msg( 'autoblockid', $row->ipb_id )->parse(); } else { - list( $target, ) = $this->blockUtils->parseBlockTarget( $row->ipb_address ); + [ $target, ] = $this->blockUtils->parseBlockTarget( $row->ipb_address ); if ( is_string( $target ) ) { if ( IPUtils::isValidRange( $target ) ) { diff --git a/includes/specials/pagers/ContribsPager.php b/includes/specials/pagers/ContribsPager.php index caa2f157bd9..ae47d1bce78 100644 --- a/includes/specials/pagers/ContribsPager.php +++ b/includes/specials/pagers/ContribsPager.php @@ -262,7 +262,7 @@ class ContribsPager extends RangeChronologicalPager { * @return IResultWrapper */ public function reallyDoQuery( $offset, $limit, $order ) { - list( $tables, $fields, $conds, $fname, $options, $join_conds ) = $this->buildQueryInfo( + [ $tables, $fields, $conds, $fname, $options, $join_conds ] = $this->buildQueryInfo( $offset, $limit, $order @@ -461,7 +461,7 @@ class ContribsPager extends RangeChronologicalPager { return false; } - list( $start, $end ) = IPUtils::parseRange( $ip ); + [ $start, $end ] = IPUtils::parseRange( $ip ); return 'ipc_hex BETWEEN ' . $db->addQuotes( $start ) . ' AND ' . $db->addQuotes( $end ); } @@ -804,7 +804,7 @@ class ContribsPager extends RangeChronologicalPager { ); # Tags, if any. - list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( + [ $tagSummary, $newClasses ] = ChangeTags::formatSummaryRow( $row->ts_tags, 'contributions', $this->getContext() diff --git a/includes/specials/pagers/DeletedContribsPager.php b/includes/specials/pagers/DeletedContribsPager.php index d602c216339..074713c8c97 100644 --- a/includes/specials/pagers/DeletedContribsPager.php +++ b/includes/specials/pagers/DeletedContribsPager.php @@ -370,7 +370,7 @@ class DeletedContribsPager extends ReverseChronologicalPager { ); // Tags, if any. - list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( + [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow( $row->ts_tags, 'deletedcontributions', $this->getContext() diff --git a/includes/specials/pagers/ImageListPager.php b/includes/specials/pagers/ImageListPager.php index c329d1ccbe1..9b960e95b58 100644 --- a/includes/specials/pagers/ImageListPager.php +++ b/includes/specials/pagers/ImageListPager.php @@ -323,7 +323,7 @@ class ImageListPager extends TablePager { $dbr = $this->getDatabase(); $prevTableName = $this->mTableName; $this->mTableName = 'image'; - list( $tables, $fields, $conds, $fname, $options, $join_conds ) = + [ $tables, $fields, $conds, $fname, $options, $join_conds ] = $this->buildQueryInfo( $offset, $limit, $order ); $imageRes = $dbr->select( $tables, $fields, $conds, $fname, $options, $join_conds ); $this->mTableName = $prevTableName; @@ -343,7 +343,7 @@ class ImageListPager extends TablePager { $index = 'oi_' . substr( $index, 4 ); } - list( $tables, $fields, $conds, $fname, $options, $join_conds ) = + [ $tables, $fields, $conds, $fname, $options, $join_conds ] = $this->buildQueryInfo( $offset, $limit, $order ); $oldimageRes = $dbr->select( $tables, $fields, $conds, $fname, $options, $join_conds ); diff --git a/includes/tidy/RemexCompatMunger.php b/includes/tidy/RemexCompatMunger.php index fb8dd471c8d..c496b4cf628 100644 --- a/includes/tidy/RemexCompatMunger.php +++ b/includes/tidy/RemexCompatMunger.php @@ -183,7 +183,7 @@ class RemexCompatMunger implements TreeHandler { ) { $isBlank = strspn( $text, "\t\n\f\r ", $start, $length ) === $length; - list( $parent, $refNode ) = $this->getParentForInsert( $preposition, $refElement ); + [ $parent, $refNode ] = $this->getParentForInsert( $preposition, $refElement ); $parentData = $parent->snData; if ( $preposition === TreeBuilder::UNDER ) { @@ -270,7 +270,7 @@ class RemexCompatMunger implements TreeHandler { public function insertElement( $preposition, $refElement, Element $element, $void, $sourceStart, $sourceLength ) { - list( $parent, $newRef ) = $this->getParentForInsert( $preposition, $refElement ); + [ $parent, $newRef ] = $this->getParentForInsert( $preposition, $refElement ); $parentData = $parent->snData; $elementName = $element->htmlName; @@ -488,7 +488,7 @@ class RemexCompatMunger implements TreeHandler { } public function comment( $preposition, $refElement, $text, $sourceStart, $sourceLength ) { - list( , $refNode ) = $this->getParentForInsert( $preposition, $refElement ); + [ , $refNode ] = $this->getParentForInsert( $preposition, $refElement ); $this->serializer->comment( $preposition, $refNode, $text, $sourceStart, $sourceLength ); } diff --git a/includes/title/NaiveForeignTitleFactory.php b/includes/title/NaiveForeignTitleFactory.php index 3dc9bb4e834..21cece51663 100644 --- a/includes/title/NaiveForeignTitleFactory.php +++ b/includes/title/NaiveForeignTitleFactory.php @@ -72,7 +72,7 @@ class NaiveForeignTitleFactory implements ForeignTitleFactory { : $ns != 0; if ( count( $pieces ) === 2 && $isNamespacePartValid ) { - list( $namespaceName, $pageName ) = $pieces; + [ $namespaceName, $pageName ] = $pieces; } else { $namespaceName = ''; $pageName = $title; diff --git a/includes/title/NamespaceAwareForeignTitleFactory.php b/includes/title/NamespaceAwareForeignTitleFactory.php index e47014b58f9..b239f586666 100644 --- a/includes/title/NamespaceAwareForeignTitleFactory.php +++ b/includes/title/NamespaceAwareForeignTitleFactory.php @@ -95,7 +95,7 @@ class NamespaceAwareForeignTitleFactory implements ForeignTitleFactory { $isNamespacePartValid = isset( $this->foreignNamespacesFlipped[$key] ); if ( count( $pieces ) === 2 && $isNamespacePartValid ) { - list( $namespaceName, $pageName ) = $pieces; + [ $namespaceName, $pageName ] = $pieces; $ns = $this->foreignNamespacesFlipped[$key]; } else { $namespaceName = ''; diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index c802fd1de36..3c77e989629 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -1029,7 +1029,7 @@ abstract class UploadBase { * We'll want to blacklist against *any* 'extension', and use * only the final one for the whitelist. */ - list( $partname, $ext ) = $this->splitExtensions( $this->mFilteredName ); + [ $partname, $ext ] = $this->splitExtensions( $this->mFilteredName ); if ( $ext !== [] ) { $this->mFinalExtension = trim( end( $ext ) ); @@ -1565,7 +1565,7 @@ abstract class UploadBase { * @return bool|array */ public function checkSvgScriptCallback( $element, $attribs, $data = null ) { - list( $namespace, $strippedElement ) = $this->splitXmlNamespace( $element ); + [ $namespace, $strippedElement ] = $this->splitXmlNamespace( $element ); // We specifically don't include: // http://www.w3.org/1999/xhtml (T62771) diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php index afe8dc46d31..d4d071b1d71 100644 --- a/includes/upload/UploadStash.php +++ b/includes/upload/UploadStash.php @@ -229,7 +229,7 @@ class UploadStash { // random thing instead. At least it's not guessable. // Some things that when combined will make a suitably unique key. // see: http://www.jwz.org/doc/mid.html - list( $usec, $sec ) = explode( ' ', microtime() ); + [ $usec, $sec ] = explode( ' ', microtime() ); $usec = substr( $usec, 2 ); $key = Wikimedia\base_convert( $sec . $usec, 10, 36 ) . '.' . Wikimedia\base_convert( (string)mt_rand(), 10, 36 ) . '.' . diff --git a/includes/user/BotPassword.php b/includes/user/BotPassword.php index 73d68b5b81d..cda6f8baaee 100644 --- a/includes/user/BotPassword.php +++ b/includes/user/BotPassword.php @@ -204,7 +204,7 @@ class BotPassword implements IDBAccessObject { * @return Password */ private function getPassword() { - list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $this->flags ); + [ $index, $options ] = DBAccessObjectUtils::getDBOptions( $this->flags ); $db = self::getDB( $index ); $password = $db->selectField( 'bot_passwords', @@ -424,7 +424,7 @@ class BotPassword implements IDBAccessObject { if ( strpos( $username, $sep ) === false ) { return self::loginHook( $username, null, Status::newFatal( 'botpasswords-invalid-name', $sep ) ); } - list( $name, $appId ) = explode( $sep, $username, 2 ); + [ $name, $appId ] = explode( $sep, $username, 2 ); // Find the named user $user = User::newFromName( $name ); diff --git a/includes/user/BotPasswordStore.php b/includes/user/BotPasswordStore.php index d1355bdd975..f78a3146839 100644 --- a/includes/user/BotPasswordStore.php +++ b/includes/user/BotPasswordStore.php @@ -141,7 +141,7 @@ class BotPasswordStore implements IDBAccessObject { return null; } - list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags ); + [ $index, $options ] = DBAccessObjectUtils::getDBOptions( $flags ); $db = $this->getDatabase( $index ); $row = $db->selectRow( 'bot_passwords', diff --git a/includes/user/CentralId/LocalIdLookup.php b/includes/user/CentralId/LocalIdLookup.php index dacce3a166d..ea15b4ce05d 100644 --- a/includes/user/CentralId/LocalIdLookup.php +++ b/includes/user/CentralId/LocalIdLookup.php @@ -87,7 +87,7 @@ class LocalIdLookup extends CentralIdLookup { return []; } $audience = $this->checkAudience( $audience ); - list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags ); + [ $index, $options ] = DBAccessObjectUtils::getDBOptions( $flags ); $db = $this->loadBalancer->getConnectionRef( $index ); $tables = [ 'user' ]; @@ -118,7 +118,7 @@ class LocalIdLookup extends CentralIdLookup { } $audience = $this->checkAudience( $audience ); - list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags ); + [ $index, $options ] = DBAccessObjectUtils::getDBOptions( $flags ); $db = $this->loadBalancer->getConnectionRef( $index ); $tables = [ 'user' ]; diff --git a/includes/user/TalkPageNotificationManager.php b/includes/user/TalkPageNotificationManager.php index 3de529befa8..9d050775df0 100644 --- a/includes/user/TalkPageNotificationManager.php +++ b/includes/user/TalkPageNotificationManager.php @@ -225,7 +225,7 @@ class TalkPageNotificationManager { } $dbr = $this->loadBalancer->getConnectionRef( DB_REPLICA ); - list( $field, $id ) = $this->getQueryFieldAndId( $user ); + [ $field, $id ] = $this->getQueryFieldAndId( $user ); // Get the "last viewed rev" timestamp from the oldest message notification $timestamp = $dbr->selectField( 'user_newtalk', @@ -267,7 +267,7 @@ class TalkPageNotificationManager { */ private function dbCheckNewUserMessages( UserIdentity $user ): bool { $dbr = $this->loadBalancer->getConnectionRef( DB_REPLICA ); - list( $field, $id ) = $this->getQueryFieldAndId( $user ); + [ $field, $id ] = $this->getQueryFieldAndId( $user ); $ok = $dbr->selectField( 'user_newtalk', $field, @@ -301,7 +301,7 @@ class TalkPageNotificationManager { // Mark the user as having new messages since this revision $dbw = $this->loadBalancer->getConnectionRef( DB_PRIMARY ); - list( $field, $id ) = $this->getQueryFieldAndId( $user ); + [ $field, $id ] = $this->getQueryFieldAndId( $user ); $dbw->insert( 'user_newtalk', [ @@ -324,7 +324,7 @@ class TalkPageNotificationManager { return false; } $dbw = $this->loadBalancer->getConnectionRef( DB_PRIMARY ); - list( $field, $id ) = $this->getQueryFieldAndId( $user ); + [ $field, $id ] = $this->getQueryFieldAndId( $user ); $dbw->delete( 'user_newtalk', [ $field => $id ], diff --git a/includes/user/UserFactory.php b/includes/user/UserFactory.php index 532572e9489..4d3ae9dca04 100644 --- a/includes/user/UserFactory.php +++ b/includes/user/UserFactory.php @@ -266,7 +266,7 @@ class UserFactory implements IDBAccessObject, UserRigorOptions { string $confirmationCode, int $flags = self::READ_NORMAL ) { - list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags ); + [ $index, $options ] = DBAccessObjectUtils::getDBOptions( $flags ); $db = $this->loadBalancer->getConnectionRef( $index ); diff --git a/includes/user/UserGroupManager.php b/includes/user/UserGroupManager.php index 43ca958217f..dc9c91d1f0b 100644 --- a/includes/user/UserGroupManager.php +++ b/includes/user/UserGroupManager.php @@ -1174,7 +1174,7 @@ class UserGroupManager implements IDBAccessObject { * @return DBConnRef */ private function getDBConnectionRefForQueryFlags( int $queryFlags ): DBConnRef { - list( $mode, ) = DBAccessObjectUtils::getDBOptions( $queryFlags ); + [ $mode, ] = DBAccessObjectUtils::getDBOptions( $queryFlags ); return $this->loadBalancer->getConnectionRef( $mode, [], $this->dbDomain ); } diff --git a/includes/user/UserOptionsManager.php b/includes/user/UserOptionsManager.php index bfc086fce62..171cc59c20e 100644 --- a/includes/user/UserOptionsManager.php +++ b/includes/user/UserOptionsManager.php @@ -650,7 +650,7 @@ class UserOptionsManager extends UserOptionsLookup { * @return array [ IDatabase $db, array $options ] */ private function getDBAndOptionsForQueryFlags( $queryFlags ): array { - list( $mode, $options ) = DBAccessObjectUtils::getDBOptions( $queryFlags ); + [ $mode, $options ] = DBAccessObjectUtils::getDBOptions( $queryFlags ); return [ $this->loadBalancer->getConnectionRef( $mode, [] ), $options ]; } diff --git a/includes/utils/MWFileProps.php b/includes/utils/MWFileProps.php index 995770e784c..6cdb8da38c4 100644 --- a/includes/utils/MWFileProps.php +++ b/includes/utils/MWFileProps.php @@ -79,7 +79,7 @@ class MWFileProps { # Unclear if callers of this method expect that. $info['mime'] = $this->magic->improveTypeFromExtension( $info['file-mime'], $ext ); - list( $info['major_mime'], $info['minor_mime'] ) = File::splitMime( $info['mime'] ); + [ $info['major_mime'], $info['minor_mime'] ] = File::splitMime( $info['mime'] ); $info['media_type'] = $this->magic->getMediaType( $path, $info['mime'] ); # Height, width and metadata diff --git a/includes/utils/ZipDirectoryReader.php b/includes/utils/ZipDirectoryReader.php index b39ce8c00ea..f287cd49632 100644 --- a/includes/utils/ZipDirectoryReader.php +++ b/includes/utils/ZipDirectoryReader.php @@ -168,7 +168,7 @@ class ZipDirectoryReader { try { $this->readEndOfCentralDirectoryRecord(); if ( $this->zip64 ) { - list( $offset, $size ) = $this->findZip64CentralDirectory(); + [ $offset, $size ] = $this->findZip64CentralDirectory(); $this->readCentralDirectory( $offset, $size ); } else { if ( $this->eocdr['CD size'] == 0xffffffff @@ -180,7 +180,7 @@ class ZipDirectoryReader { 'opening vulnerabilities on clients using OpenJDK 7 or later.' ); } - list( $offset, $size ) = $this->findOldCentralDirectory(); + [ $offset, $size ] = $this->findOldCentralDirectory(); $this->readCentralDirectory( $offset, $size ); } } catch ( ZipDirectoryReaderError $e ) { @@ -606,7 +606,7 @@ class ZipDirectoryReader { $size = 0; foreach ( $struct as $type ) { if ( is_array( $type ) ) { - list( , $fieldSize ) = $type; + [ , $fieldSize ] = $type; $size += $fieldSize; } else { $size += $type; @@ -648,7 +648,7 @@ class ZipDirectoryReader { $pos = $offset; foreach ( $struct as $key => $type ) { if ( is_array( $type ) ) { - list( $typeName, $fieldSize ) = $type; + [ $typeName, $fieldSize ] = $type; switch ( $typeName ) { case 'string': $data[$key] = substr( $string, $pos, $fieldSize ); diff --git a/includes/watcheditem/WatchedItemQueryService.php b/includes/watcheditem/WatchedItemQueryService.php index 97375f8772f..a65adfeb3e0 100644 --- a/includes/watcheditem/WatchedItemQueryService.php +++ b/includes/watcheditem/WatchedItemQueryService.php @@ -639,7 +639,7 @@ class WatchedItemQueryService { private function getStartFromConds( IDatabase $db, array $options, array $startFrom ) { $op = $options['dir'] === self::DIR_OLDER ? '<' : '>'; - list( $rcTimestamp, $rcId ) = $startFrom; + [ $rcTimestamp, $rcId ] = $startFrom; $rcTimestamp = $db->addQuotes( $db->timestamp( $rcTimestamp ) ); $rcId = (int)$rcId; return $db->makeList( diff --git a/includes/watcheditem/WatchedItemStore.php b/includes/watcheditem/WatchedItemStore.php index 3a0eadfdff1..c2e701badff 100644 --- a/includes/watcheditem/WatchedItemStore.php +++ b/includes/watcheditem/WatchedItemStore.php @@ -642,7 +642,7 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac $res = $queryBuilder->fetchResultSet(); $watcherCounts = []; - foreach ( $targetsWithVisitThresholds as list( $target ) ) { + foreach ( $targetsWithVisitThresholds as [ $target ] ) { /** @var LinkTarget|PageIdentity $target */ $watcherCounts[$target->getNamespace()][$target->getDBkey()] = 0; } @@ -668,7 +668,7 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac ): string { $missingTargets = []; $namespaceConds = []; - foreach ( $targetsWithVisitThresholds as list( $target, $threshold ) ) { + foreach ( $targetsWithVisitThresholds as [ $target, $threshold ] ) { if ( $threshold === null ) { $missingTargets[] = $target; continue; diff --git a/includes/xml/Xml.php b/includes/xml/Xml.php index 418256bab64..fcdedf771cd 100644 --- a/includes/xml/Xml.php +++ b/includes/xml/Xml.php @@ -389,7 +389,7 @@ class Xml { public static function inputLabel( $label, $name, $id, $size = false, $value = false, $attribs = [] ) { - list( $label, $input ) = self::inputLabelSep( $label, $name, $id, $size, $value, $attribs ); + [ $label, $input ] = self::inputLabelSep( $label, $name, $id, $size, $value, $attribs ); return $label . "\u{00A0}" . $input; } diff --git a/includes/xml/XmlSelect.php b/includes/xml/XmlSelect.php index e418a4ce297..915ab2bb775 100644 --- a/includes/xml/XmlSelect.php +++ b/includes/xml/XmlSelect.php @@ -151,7 +151,7 @@ class XmlSelect { $option = "$option:$option"; } // Extract the two parts. - list( $label, $value ) = explode( ':', $option ); + [ $label, $value ] = explode( ':', $option ); $options[ trim( $label ) ] = trim( $value ); } return $options; diff --git a/maintenance/cleanupInvalidDbKeys.php b/maintenance/cleanupInvalidDbKeys.php index 35ba972e207..76c5d981c2b 100644 --- a/maintenance/cleanupInvalidDbKeys.php +++ b/maintenance/cleanupInvalidDbKeys.php @@ -124,7 +124,7 @@ TEXT * @param array $tableParams A child array of self::$tables */ protected function cleanupTable( $tableParams ) { - list( $table, $prefix ) = $tableParams; + [ $table, $prefix ] = $tableParams; $idField = $tableParams['idField'] ?? "{$prefix}_id"; $nsField = $tableParams['nsField'] ?? "{$prefix}_namespace"; $titleField = $tableParams['titleField'] ?? "{$prefix}_title"; @@ -141,7 +141,7 @@ TEXT $joinConds = []; $tables = [ $table ]; if ( isset( $linksMigration::$mapping[$table] ) ) { - list( $nsField,$titleField ) = $linksMigration->getTitleFields( $table ); + [ $nsField,$titleField ] = $linksMigration->getTitleFields( $table ); $joinConds = $linksMigration->getQueryInfo( $table )['joins']; $tables = $linksMigration->getQueryInfo( $table )['tables']; } diff --git a/maintenance/cleanupUsersWithNoId.php b/maintenance/cleanupUsersWithNoId.php index d5eb396d6f5..7f0de807785 100644 --- a/maintenance/cleanupUsersWithNoId.php +++ b/maintenance/cleanupUsersWithNoId.php @@ -204,7 +204,7 @@ class CleanupUsersWithNoId extends LoggedUpdateMaintenance { } // @phan-suppress-next-line PhanTypeMismatchArgumentNullable,PhanPossiblyUndeclaredVariable row is set - list( $next, $display ) = $this->makeNextCond( $dbw, $orderby, $row ); + [ $next, $display ] = $this->makeNextCond( $dbw, $orderby, $row ); $this->output( "... $display\n" ); $lbFactory->waitForReplication(); } diff --git a/maintenance/copyJobQueue.php b/maintenance/copyJobQueue.php index 3d42cc7981e..2aa4bf0fd80 100644 --- a/maintenance/copyJobQueue.php +++ b/maintenance/copyJobQueue.php @@ -65,10 +65,10 @@ class CopyJobQueue extends Maintenance { $src = JobQueue::factory( $baseConfig + $wgJobQueueMigrationConfig[$srcKey] ); $dst = JobQueue::factory( $baseConfig + $wgJobQueueMigrationConfig[$dstKey] ); - list( $total, $totalOK ) = $this->copyJobs( $src, $dst, $src->getAllQueuedJobs() ); + [ $total, $totalOK ] = $this->copyJobs( $src, $dst, $src->getAllQueuedJobs() ); $this->output( "Copied $totalOK/$total queued $type jobs.\n" ); - list( $total, $totalOK ) = $this->copyJobs( $src, $dst, $src->getAllDelayedJobs() ); + [ $total, $totalOK ] = $this->copyJobs( $src, $dst, $src->getAllDelayedJobs() ); $this->output( "Copied $totalOK/$total delayed $type jobs.\n" ); } } diff --git a/maintenance/findOrphanedFiles.php b/maintenance/findOrphanedFiles.php index 345481f8a69..3f79a7d602c 100644 --- a/maintenance/findOrphanedFiles.php +++ b/maintenance/findOrphanedFiles.php @@ -90,7 +90,7 @@ class FindOrphanedFiles extends Maintenance { } $oldNames[] = $name; - list( , $base ) = explode( '!', $name, 2 ); // ! + [ , $base ] = explode( '!', $name, 2 ); // ! $oiWheres[] = $dbr->makeList( [ 'oi_name' => $base, 'oi_archive_name' => $name ], LIST_AND @@ -147,7 +147,7 @@ class FindOrphanedFiles extends Maintenance { } foreach ( array_diff( $oldNames, $oldNamesFound ) as $name ) { - list( , $base ) = explode( '!', $name, 2 ); // ! + [ , $base ] = explode( '!', $name, 2 ); // ! $file = $repo->newFromArchiveName( Title::makeTitle( NS_FILE, $base ), $name ); // Print name and public URL to ease recovery $this->output( $name . "\n" . $file->getCanonicalUrl() . "\n\n" ); diff --git a/maintenance/includes/BackupDumper.php b/maintenance/includes/BackupDumper.php index 74f8202868c..a74832ea3a3 100644 --- a/maintenance/includes/BackupDumper.php +++ b/maintenance/includes/BackupDumper.php @@ -247,7 +247,7 @@ abstract class BackupDumper extends Maintenance { if ( count( $split ) !== 2 ) { $this->fatalError( 'Invalid output parameter' ); } - list( $type, $file ) = $split; + [ $type, $file ] = $split; if ( $sink !== null ) { $sinks[] = $sink; } diff --git a/maintenance/includes/MWDoxygenFilter.php b/maintenance/includes/MWDoxygenFilter.php index 92bde6497f0..cbd3beb6829 100644 --- a/maintenance/includes/MWDoxygenFilter.php +++ b/maintenance/includes/MWDoxygenFilter.php @@ -64,7 +64,7 @@ class MWDoxygenFilter { $output .= $token; continue; } - list( $id, $content ) = $token; + [ $id, $content ] = $token; switch ( $id ) { case T_DOC_COMMENT: // Escape slashes so that references to namespaces are not diff --git a/maintenance/mysql.php b/maintenance/mysql.php index 8d4b2779019..b9b330b9fbe 100644 --- a/maintenance/mysql.php +++ b/maintenance/mysql.php @@ -135,7 +135,7 @@ class MysqlMaintenance extends Maintenance { } elseif ( substr_count( $realServer, ':' ) == 1 ) { // If we have a colon and something that's not a port number // inside the hostname, assume it's the socket location - list( $realServer, $socket ) = explode( ':', $realServer, 2 ); + [ $realServer, $socket ] = explode( ':', $realServer, 2 ); } if ( $dbName === false ) { diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php index e44275aa6c1..f09d3f7c117 100644 --- a/maintenance/namespaceDupes.php +++ b/maintenance/namespaceDupes.php @@ -376,7 +376,7 @@ class NamespaceDupes extends Maintenance { $linksMigration = MediaWikiServices::getInstance()->getLinksMigration(); if ( isset( $linksMigration::$mapping[$table] ) ) { $queryInfo = $linksMigration->getQueryInfo( $table ); - list( $namespaceField, $titleField ) = $linksMigration->getTitleFields( $table ); + [ $namespaceField, $titleField ] = $linksMigration->getTitleFields( $table ); } else { $queryInfo = [ 'tables' => [ $table ], diff --git a/maintenance/purgeChangedPages.php b/maintenance/purgeChangedPages.php index ad570a7ef22..da721a076de 100644 --- a/maintenance/purgeChangedPages.php +++ b/maintenance/purgeChangedPages.php @@ -110,7 +110,7 @@ class PurgeChangedPages extends Maintenance { } // Kludge to not get stuck in loops for batches with the same timestamp - list( $rows, $lastTime ) = $this->pageableSortedRows( $res, 'rev_timestamp', $bSize ); + [ $rows, $lastTime ] = $this->pageableSortedRows( $res, 'rev_timestamp', $bSize ); if ( !count( $rows ) ) { ++$stuckCount; continue; diff --git a/maintenance/refreshImageMetadata.php b/maintenance/refreshImageMetadata.php index 6e9c2a5fc57..252c6198ff7 100644 --- a/maintenance/refreshImageMetadata.php +++ b/maintenance/refreshImageMetadata.php @@ -235,7 +235,7 @@ class RefreshImageMetadata extends Maintenance { $conds[] = $fieldPrefix . 'name <= ' . $dbw->addQuotes( $end ); } if ( $mime !== false ) { - list( $major, $minor ) = File::splitMime( $mime ); + [ $major, $minor ] = File::splitMime( $mime ); $conds[$fieldPrefix . 'major_mime'] = $major; if ( $minor !== '*' ) { $conds[$fieldPrefix . 'minor_mime'] = $minor; diff --git a/maintenance/storage/checkStorage.php b/maintenance/storage/checkStorage.php index 1df3731285a..b593ece2612 100644 --- a/maintenance/storage/checkStorage.php +++ b/maintenance/storage/checkStorage.php @@ -187,7 +187,7 @@ class CheckStorage { $this->addError( 'restore text', "Error: invalid URL \"{$row->old_text}\"", $row->old_id ); continue; } - list( $proto, ) = $urlParts; + [ $proto, ] = $urlParts; if ( $proto != 'DB' ) { $this->addError( 'restore text', diff --git a/maintenance/updateSpecialPages.php b/maintenance/updateSpecialPages.php index 02d810bd658..2c42f9fd48b 100644 --- a/maintenance/updateSpecialPages.php +++ b/maintenance/updateSpecialPages.php @@ -52,7 +52,7 @@ class UpdateSpecialPages extends Maintenance { $queryCacheLimit = (int)$config->get( MainConfigNames::QueryCacheLimit ); $disabledQueryPages = QueryPage::getDisabledQueryPages( $config ); foreach ( QueryPage::getPages() as $page ) { - list( , $special ) = $page; + [ , $special ] = $page; $limit = $page[2] ?? $queryCacheLimit; # --list : just show the name of pages diff --git a/maintenance/uppercaseTitlesForUnicodeTransition.php b/maintenance/uppercaseTitlesForUnicodeTransition.php index d0bb9497f00..d066d44c349 100644 --- a/maintenance/uppercaseTitlesForUnicodeTransition.php +++ b/maintenance/uppercaseTitlesForUnicodeTransition.php @@ -281,7 +281,7 @@ class UppercaseTitlesForUnicodeTransition extends Maintenance { return false; } - list( $base ) = explode( '/', $title, 2 ); + [ $base ] = explode( '/', $title, 2 ); if ( !isset( $this->seenUsers[$base] ) ) { // Can't use User directly because it might uppercase the name $this->seenUsers[$base] = (bool)$db->selectField( diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index 1150e2ebb5b..8fc93715353 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -1442,7 +1442,7 @@ class ParserTestRunner { if ( is_callable( $rawExpected ) ) { $rawExpected = $rawExpected(); } - list( $actual, $expected ) = $normalizer( $rawActual, $rawExpected, false /* standalone */ ); + [ $actual, $expected ] = $normalizer( $rawActual, $rawExpected, false /* standalone */ ); $passed = $actual === $expected; $unexpectedPass = $expectedToFail && $passed; @@ -1752,7 +1752,7 @@ class ParserTestRunner { } $mode = new ParserTestMode( 'selser', $test->changetree ); } - list( $out, $expected ) = $this->runSelserEditTest( $parsoid, $pageConfig, $test, $mode, $doc ); + [ $out, $expected ] = $this->runSelserEditTest( $parsoid, $pageConfig, $test, $mode, $doc ); return new ParserTestResult( $test, $mode, @@ -1783,7 +1783,7 @@ class ParserTestRunner { $mode->changetree === $test->changetree, "changetree should be consistent with mode" ); - list( $out, $expected ) = $this->runSelserEditTest( $parsoid, $pageConfig, $test, $mode, $doc ); + [ $out, $expected ] = $this->runSelserEditTest( $parsoid, $pageConfig, $test, $mode, $doc ); return new ParserTestResult( $test, $mode, $expected, $out ); } else { // this mode is a composite of multiple selser tests @@ -1801,7 +1801,7 @@ class ParserTestRunner { if ( $test->changetree ) { // new mode with the generated changetree $nmode = new ParserTestMode( 'selser', $test->changetree ); - list( $out, $expected ) = $this->runSelserEditTest( $parsoid, $pageConfig, $test, $nmode, $doc ); + [ $out, $expected ] = $this->runSelserEditTest( $parsoid, $pageConfig, $test, $nmode, $doc ); $testTitle = "TEST: {$test->testName} ($nmode)\n"; $bufOut .= $testTitle; $bufExpected .= $testTitle; diff --git a/tests/phpunit/includes/ActorMigrationTest.php b/tests/phpunit/includes/ActorMigrationTest.php index 6527694767e..b6d7fbe5cfd 100644 --- a/tests/phpunit/includes/ActorMigrationTest.php +++ b/tests/phpunit/includes/ActorMigrationTest.php @@ -67,7 +67,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase { private static function makeActorCases( $inputs, $expected ) { foreach ( $expected as $inputName => $expectedCases ) { - foreach ( $expectedCases as list( $stages, $expected ) ) { + foreach ( $expectedCases as [ $stages, $expected ] ) { foreach ( $stages as $stage ) { $cases[$inputName . ', ' . $stage] = array_merge( [ $stage ], @@ -593,7 +593,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase { $w = $this->getMigration( $writeStage ); if ( $usesTemp ) { - list( $fields, $callback ) = $w->getInsertValuesWithTempTable( $this->db, $key, $user ); + [ $fields, $callback ] = $w->getInsertValuesWithTempTable( $this->db, $key, $user ); } else { $fields = $w->getInsertValues( $this->db, $key, $user ); } @@ -698,7 +698,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase { $stage, $this->getServiceContainer()->getActorStoreFactory() ); - list( $fields, $callback ) + [ $fields, $callback ] = $m->getInsertValuesWithTempTable( $this->db, 'am1_user', $this->getTestUser()->getUser() ); $this->assertIsCallable( $callback ); } @@ -723,7 +723,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase { $stage, $this->getServiceContainer()->getActorStoreFactory() ); - list( $fields, $callback ) + [ $fields, $callback ] = $m->getInsertValuesWithTempTable( $this->db, 'foo_user', $this->getTestUser()->getUser() ); $this->expectException( InvalidArgumentException::class ); $this->expectExceptionMessage( '$extra[foo_timestamp] is not provided' ); @@ -739,7 +739,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase { $userIdentity = new UserIdentityValue( $user->getId(), $user->getName() ); $m = $this->getMigration( $stage ); - list( $fields, $callback ) = + [ $fields, $callback ] = $m->getInsertValuesWithTempTable( $this->db, 'am2_user', $userIdentity ); $id = ++self::$amId; $this->db->insert( 'actormigration2', [ 'am2_id' => $id ] + $fields, __METHOD__ ); diff --git a/tests/phpunit/includes/CommentStoreTest.php b/tests/phpunit/includes/CommentStoreTest.php index 6e4cefc4f61..619d03e2cb1 100644 --- a/tests/phpunit/includes/CommentStoreTest.php +++ b/tests/phpunit/includes/CommentStoreTest.php @@ -553,7 +553,7 @@ class CommentStoreTest extends MediaWikiLangTestCase { $usesTemp = $key === 'cs2_comment'; if ( $usesTemp ) { - list( $fields, $callback ) = $wstore->insertWithTempTable( + [ $fields, $callback ] = $wstore->insertWithTempTable( $this->db, $key, $comment, $data ); } else { @@ -815,7 +815,7 @@ class CommentStoreTest extends MediaWikiLangTestCase { }; $this->hideDeprecated( 'CommentStore::insertWithTempTable for ipb_reason' ); - list( $fields, $callback ) = $store->insertWithTempTable( $this->db, 'ipb_reason', 'foo' ); + [ $fields, $callback ] = $store->insertWithTempTable( $this->db, 'ipb_reason', 'foo' ); $this->assertIsCallable( $callback ); } diff --git a/tests/phpunit/includes/MediaWikiServicesTest.php b/tests/phpunit/includes/MediaWikiServicesTest.php index 0a91232a27e..65bda09a282 100644 --- a/tests/phpunit/includes/MediaWikiServicesTest.php +++ b/tests/phpunit/includes/MediaWikiServicesTest.php @@ -318,7 +318,7 @@ class MediaWikiServicesTest extends MediaWikiIntegrationTestCase { // Internal service, no getter continue; } - list( $service, $class ) = $case; + [ $service, $class ] = $case; $getterCases[$name] = [ 'get' . $service, $class, diff --git a/tests/phpunit/includes/MultiHttpClientTest.php b/tests/phpunit/includes/MultiHttpClientTest.php index 596bb6a2b43..4dec4277836 100644 --- a/tests/phpunit/includes/MultiHttpClientTest.php +++ b/tests/phpunit/includes/MultiHttpClientTest.php @@ -62,7 +62,7 @@ class MultiHttpClientTest extends MediaWikiIntegrationTestCase { $httpRequest = $this->getHttpRequest( StatusValue::newGood( 200 ), 200 ); $this->setService( 'HttpRequestFactory', $this->mockHttpRequestFactory( $httpRequest ) ); - list( $rcode, $rdesc, /* $rhdrs */, $rbody, $rerr ) = $this->client->run( [ + [ $rcode, $rdesc, /* $rhdrs */, $rbody, $rerr ] = $this->client->run( [ 'method' => 'GET', 'url' => "http://example.test", ] ); @@ -79,7 +79,7 @@ class MultiHttpClientTest extends MediaWikiIntegrationTestCase { StatusValue::newFatal( 'http-invalid-url', 'http://www.example.test' ), 0 ); $this->setService( 'HttpRequestFactory', $this->mockHttpRequestFactory( $httpRequest ) ); - list( $rcode, $rdesc, /* $rhdrs */, $rbody, $rerr ) = $this->client->run( [ + [ $rcode, $rdesc, /* $rhdrs */, $rbody, $rerr ] = $this->client->run( [ 'method' => 'GET', 'url' => "http://www.example.test", ] ); @@ -107,7 +107,7 @@ class MultiHttpClientTest extends MediaWikiIntegrationTestCase { ]; $responses = $this->client->runMulti( $reqs ); foreach ( $responses as $response ) { - list( $rcode, $rdesc, /* $rhdrs */, $rbody, $rerr ) = $response['response']; + [ $rcode, $rdesc, /* $rhdrs */, $rbody, $rerr ] = $response['response']; $this->assertSame( 200, $rcode ); } } @@ -133,7 +133,7 @@ class MultiHttpClientTest extends MediaWikiIntegrationTestCase { ]; $responses = $this->client->runMulti( $reqs ); foreach ( $responses as $response ) { - list( $rcode, $rdesc, /* $rhdrs */, $rbody, $rerr ) = $response['response']; + [ $rcode, $rdesc, /* $rhdrs */, $rbody, $rerr ] = $response['response']; $this->assertSame( 404, $rcode ); } } @@ -160,7 +160,7 @@ class MultiHttpClientTest extends MediaWikiIntegrationTestCase { $httpRequest = $this->getHttpRequest( StatusValue::newGood( 200 ), 200, $headers ); $this->setService( 'HttpRequestFactory', $this->mockHttpRequestFactory( $httpRequest ) ); - list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->client->run( [ + [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] = $this->client->run( [ 'method' => 'GET', 'url' => 'http://example.test', ] ); diff --git a/tests/phpunit/includes/Revision/RevisionStoreDbTest.php b/tests/phpunit/includes/Revision/RevisionStoreDbTest.php index 4505d6d42d8..b393cf65d3e 100644 --- a/tests/phpunit/includes/Revision/RevisionStoreDbTest.php +++ b/tests/phpunit/includes/Revision/RevisionStoreDbTest.php @@ -1370,7 +1370,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { public function testNewRevisionFromArchiveRowAndSlots_getArchiveQueryInfo() { $text = __METHOD__ . '-bรค'; $title = Title::newFromText( __METHOD__ ); - list( $store, $row, $slotRows, $orig ) = $this->buildRevisionStore( $text, $title ); + [ $store, $row, $slotRows, $orig ] = $this->buildRevisionStore( $text, $title ); $storeRecord = $store->newRevisionFromArchiveRowAndSlots( $row, iterator_to_array( $slotRows ) @@ -1397,7 +1397,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { public function testNewRevisionFromArchiveRowAndSlots_getArchiveQueryInfoWithTitle( $getPageIdentity ) { $text = __METHOD__ . '-bรค'; $page = $getPageIdentity(); - list( $store, $row, $slotRows, $orig ) = $this->buildRevisionStore( $text, $page ); + [ $store, $row, $slotRows, $orig ] = $this->buildRevisionStore( $text, $page ); $storeRecord = $store->newRevisionFromArchiveRowAndSlots( $row, iterator_to_array( $slotRows ), @@ -1431,7 +1431,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { public function testNewRevisionFromArchiveRowAndSlots_getArchiveQueryInfoWithTitleInArray( $array ) { $text = __METHOD__ . '-bรค'; $page = $array[ 'title' ]; - list( $store, $row, $slotRows, $orig ) = $this->buildRevisionStore( $text, $page ); + [ $store, $row, $slotRows, $orig ] = $this->buildRevisionStore( $text, $page ); $storeRecord = $store->newRevisionFromArchiveRowAndSlots( $row, iterator_to_array( $slotRows ), @@ -1703,7 +1703,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { public function testInsertRevisionOn_archive( $getPageIdentity ) { // This is a round trip test for deletion and undeletion of a // revision row via the archive table. - list( $title, $pageIdentity ) = $getPageIdentity(); + [ $title, $pageIdentity ] = $getPageIdentity(); $store = $this->getServiceContainer()->getRevisionStore(); $page = WikiPage::factory( $title ); @@ -2542,7 +2542,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $otherPageTitle = null, array $options = [] ) { - list( $title1, $pageIdentity ) = $getPageIdentity(); + [ $title1, $pageIdentity ] = $getPageIdentity(); $text1 = __METHOD__ . '-bรค'; $page1 = WikiPage::factory( $title1 ); @@ -2925,7 +2925,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { * @param callable $getPageIdentity */ public function testGetFirstRevision( $getPageIdentity ) { - list( $pageTitle, $pageIdentity ) = $getPageIdentity(); + [ $pageTitle, $pageIdentity ] = $getPageIdentity(); $editStatus = $this->editPage( $pageTitle->getPrefixedDBkey(), 'First Revision' ); $this->assertStatusGood( $editStatus, 'must create first revision' ); $firstRevId = $editStatus->getValue()['revision-record']->getID(); diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index 61ca4da5e77..c0523b69b3f 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -736,7 +736,7 @@ class StatusTest extends MediaWikiLangTestCase { $sv = StatusValue::newFatal( 'fatal' ); $sv->warning( 'warning' ); $s = Status::wrap( $sv ); - list( $se, $sw ) = $s->splitByErrorType(); + [ $se, $sw ] = $s->splitByErrorType(); $this->assertTrue( $s->hasMessage( 'fatal' ) ); $this->assertTrue( $s->hasMessage( 'warning' ) ); $this->assertFalse( $s->isOK() ); diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php index 8be793d9d04..62767c9c11d 100644 --- a/tests/phpunit/includes/api/ApiEditPageTest.php +++ b/tests/phpunit/includes/api/ApiEditPageTest.php @@ -137,7 +137,7 @@ class ApiEditPageTest extends ApiTestCase { // -- create page (or not) ----------------------------------------- if ( $text !== null ) { - list( $re ) = $this->doApiRequestWithToken( [ + [ $re ] = $this->doApiRequestWithToken( [ 'action' => 'edit', 'title' => $name, 'text' => $text, ] ); @@ -146,7 +146,7 @@ class ApiEditPageTest extends ApiTestCase { } // -- try append/prepend -------------------------------------------- - list( $re ) = $this->doApiRequestWithToken( [ + [ $re ] = $this->doApiRequestWithToken( [ 'action' => 'edit', 'title' => $name, $op . 'text' => $append, ] ); @@ -178,7 +178,7 @@ class ApiEditPageTest extends ApiTestCase { 'summary' ); - list( $re ) = $this->doApiRequestWithToken( [ + [ $re ] = $this->doApiRequestWithToken( [ 'action' => 'edit', 'title' => $name, 'section' => '1', @@ -216,7 +216,7 @@ class ApiEditPageTest extends ApiTestCase { // Test on a page that does not already exist $this->assertFalse( Title::newFromText( $name )->exists() ); - list( $re ) = $this->doApiRequestWithToken( [ + [ $re ] = $this->doApiRequestWithToken( [ 'action' => 'edit', 'title' => $name, 'section' => 'new', @@ -233,7 +233,7 @@ class ApiEditPageTest extends ApiTestCase { // Now on one that does $this->assertTrue( Title::newFromText( $name )->exists() ); - list( $re2 ) = $this->doApiRequestWithToken( [ + [ $re2 ] = $this->doApiRequestWithToken( [ 'action' => 'edit', 'title' => $name, 'section' => 'new', @@ -411,7 +411,7 @@ class ApiEditPageTest extends ApiTestCase { $this->forceRevisionDate( $rpage, '20120101020202' ); // try to save edit, following the redirect - list( $re, , ) = $this->doApiRequestWithToken( [ + [ $re, , ] = $this->doApiRequestWithToken( [ 'action' => 'edit', 'title' => $rname, 'text' => 'nix bar!', @@ -615,7 +615,7 @@ class ApiEditPageTest extends ApiTestCase { $this->forceRevisionDate( $page, '20120101020202' ); // try to save edit, expect no conflict - list( $re, , ) = $this->doApiRequestWithToken( [ + [ $re, , ] = $this->doApiRequestWithToken( [ 'action' => 'edit', 'title' => $name, 'text' => 'nix bar!', @@ -678,7 +678,7 @@ class ApiEditPageTest extends ApiTestCase { $this->forceRevisionDate( $rpage, '20120101020202' ); // try to save edit; should work, following the redirect. - list( $re, , ) = $this->doApiRequestWithToken( [ + [ $re, , ] = $this->doApiRequestWithToken( [ 'action' => 'edit', 'title' => $rname, 'text' => 'nix bar!', diff --git a/tests/phpunit/includes/api/ApiLoginTest.php b/tests/phpunit/includes/api/ApiLoginTest.php index 215fc3a966a..0ab30aa0b4b 100644 --- a/tests/phpunit/includes/api/ApiLoginTest.php +++ b/tests/phpunit/includes/api/ApiLoginTest.php @@ -351,7 +351,7 @@ class ApiLoginTest extends ApiTestCase { $throttle ); - list( $name, $password ) = $this->setUpForBotPassword(); + [ $name, $password ] = $this->setUpForBotPassword(); for ( $i = 0; $i < $throttle[0]['count']; $i++ ) { $this->doUserLogin( $name, 'incorrectpasswordincorrectpassword' ); diff --git a/tests/phpunit/includes/api/ApiOpenSearchTest.php b/tests/phpunit/includes/api/ApiOpenSearchTest.php index 9df73aae8c0..fb1220e0338 100644 --- a/tests/phpunit/includes/api/ApiOpenSearchTest.php +++ b/tests/phpunit/includes/api/ApiOpenSearchTest.php @@ -13,7 +13,7 @@ class ApiOpenSearchTest extends MediaWikiIntegrationTestCase { $config->method( 'getSearchTypes' ) ->willReturn( [ 'the one ring' ] ); - list( $engine, $engineFactory ) = $this->replaceSearchEngine(); + [ $engine, $engineFactory ] = $this->replaceSearchEngine(); $ctx = new RequestContext(); $apiMain = new ApiMain( $ctx ); diff --git a/tests/phpunit/includes/api/ApiPageSetTest.php b/tests/phpunit/includes/api/ApiPageSetTest.php index d353b59c131..c408623bf8f 100644 --- a/tests/phpunit/includes/api/ApiPageSetTest.php +++ b/tests/phpunit/includes/api/ApiPageSetTest.php @@ -39,7 +39,7 @@ class ApiPageSetTest extends ApiTestCase { * @dataProvider provideRedirectMergePolicy */ public function testRedirectMergePolicyWithArrayResult( $mergePolicy, $expect ) { - list( $target, $pageSet ) = $this->createPageSetWithRedirect(); + [ $target, $pageSet ] = $this->createPageSetWithRedirect(); $pageSet->setRedirectMergePolicy( $mergePolicy ); $result = [ $target->getArticleID() => [] @@ -52,7 +52,7 @@ class ApiPageSetTest extends ApiTestCase { * @dataProvider provideRedirectMergePolicy */ public function testRedirectMergePolicyWithApiResult( $mergePolicy, $expect ) { - list( $target, $pageSet ) = $this->createPageSetWithRedirect(); + [ $target, $pageSet ] = $this->createPageSetWithRedirect(); $pageSet->setRedirectMergePolicy( $mergePolicy ); $result = new ApiResult( false ); $result->addValue( null, 'pages', [ @@ -98,7 +98,7 @@ class ApiPageSetTest extends ApiTestCase { $loopB = Title::makeTitle( NS_MAIN, 'UTPageRedirectTwo' ); $this->editPage( 'UTPageRedirectOne', '#REDIRECT [[UTPageRedirectTwo]]' ); $this->editPage( 'UTPageRedirectTwo', '#REDIRECT [[UTPageRedirectOne]]' ); - list( $target, $pageSet ) = $this->createPageSetWithRedirect( + [ $target, $pageSet ] = $this->createPageSetWithRedirect( '#REDIRECT [[UTPageRedirectOne]]' ); $pageSet->setRedirectMergePolicy( static function ( $cur, $new ) { diff --git a/tests/phpunit/includes/api/ApiPurgeTest.php b/tests/phpunit/includes/api/ApiPurgeTest.php index c323aa88352..18ce3afc19a 100644 --- a/tests/phpunit/includes/api/ApiPurgeTest.php +++ b/tests/phpunit/includes/api/ApiPurgeTest.php @@ -13,7 +13,7 @@ class ApiPurgeTest extends ApiTestCase { $this->getExistingTestPage( 'UTPage' ); $this->getNonexistingTestPage( 'UTPage-NotFound' ); - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'purge', 'titles' => 'UTPage|UTPage-NotFound|%5D' ] ); diff --git a/tests/phpunit/includes/api/ApiUploadTest.php b/tests/phpunit/includes/api/ApiUploadTest.php index c8fb806c3d5..b4d33ebd15a 100644 --- a/tests/phpunit/includes/api/ApiUploadTest.php +++ b/tests/phpunit/includes/api/ApiUploadTest.php @@ -61,7 +61,7 @@ class ApiUploadTest extends ApiUploadTestCase { $user = self::$users['uploader']->getUser(); $this->fakeUploadFile( 'file', $fileName, $mimeType, $filePath ); - list( $result ) = $this->doApiRequestWithToken( [ + [ $result ] = $this->doApiRequestWithToken( [ 'action' => 'upload', 'filename' => $fileName, 'file' => 'dummy content', @@ -116,7 +116,7 @@ class ApiUploadTest extends ApiUploadTestCase { // first upload .... should succeed $this->fakeUploadFile( 'file', $fileName, $mimeType, $filePaths[0] ); - list( $result ) = $this->doApiRequestWithToken( $params, null, + [ $result ] = $this->doApiRequestWithToken( $params, null, self::$users['uploader']->getUser() ); $this->assertArrayHasKey( 'upload', $result ); $this->assertEquals( 'Success', $result['upload']['result'] ); @@ -124,7 +124,7 @@ class ApiUploadTest extends ApiUploadTestCase { // second upload with the same name (but different content) $this->fakeUploadFile( 'file', $fileName, $mimeType, $filePaths[1] ); - list( $result ) = $this->doApiRequestWithToken( $params, null, + [ $result ] = $this->doApiRequestWithToken( $params, null, self::$users['uploader']->getUser() ); $this->assertArrayHasKey( 'upload', $result ); $this->assertEquals( 'Warning', $result['upload']['result'] ); @@ -139,7 +139,7 @@ class ApiUploadTest extends ApiUploadTestCase { // first upload .... should succeed $this->fakeUploadFile( 'file', $fileNames[0], $mimeType, $filePath ); - list( $result ) = $this->doApiRequestWithToken( [ + [ $result ] = $this->doApiRequestWithToken( [ 'action' => 'upload', 'filename' => $fileNames[0], 'file' => 'dummy content', @@ -151,7 +151,7 @@ class ApiUploadTest extends ApiUploadTestCase { // second upload with the same content (but different name) $this->fakeUploadFile( 'file', $fileNames[1], $mimeType, $filePath ); - list( $result ) = $this->doApiRequestWithToken( [ + [ $result ] = $this->doApiRequestWithToken( [ 'action' => 'upload', 'filename' => $fileNames[1], 'file' => 'dummy content', @@ -173,7 +173,7 @@ class ApiUploadTest extends ApiUploadTestCase { $filePath = $this->filePath( 'yuv420.jpg' ); $this->fakeUploadFile( 'file', $fileName, $mimeType, $filePath ); - list( $result ) = $this->doApiRequestWithToken( [ + [ $result ] = $this->doApiRequestWithToken( [ 'action' => 'upload', 'stash' => 1, 'filename' => $fileName, @@ -195,7 +195,7 @@ class ApiUploadTest extends ApiUploadTestCase { // now we should try to release the file from stash $this->clearFakeUploads(); - list( $result ) = $this->doApiRequestWithToken( [ + [ $result ] = $this->doApiRequestWithToken( [ 'action' => 'upload', 'filekey' => $filekey, 'filename' => $fileName, @@ -234,7 +234,7 @@ class ApiUploadTest extends ApiUploadTestCase { // Upload the current chunk into the $_FILE object: $this->fakeUploadChunk( 'chunk', 'blob', $mimeType, $chunkData ); if ( !$filekey ) { - list( $result ) = $this->doApiRequestWithToken( $params, null, + [ $result ] = $this->doApiRequestWithToken( $params, null, self::$users['uploader']->getUser() ); // Make sure we got a valid chunk continue: $this->assertArrayHasKey( 'upload', $result ); @@ -253,7 +253,7 @@ class ApiUploadTest extends ApiUploadTestCase { // Make sure param offset is insync with resultOffset: $this->assertEquals( $resultOffset, $params['offset'] ); // Upload current chunk - list( $result ) = $this->doApiRequestWithToken( $params, null, + [ $result ] = $this->doApiRequestWithToken( $params, null, self::$users['uploader']->getUser() ); // Make sure we got a valid chunk continue: $this->assertArrayHasKey( 'upload', $result ); @@ -279,7 +279,7 @@ class ApiUploadTest extends ApiUploadTestCase { // Now we should try to release the file from stash $this->clearFakeUploads(); - list( $result ) = $this->doApiRequestWithToken( [ + [ $result ] = $this->doApiRequestWithToken( [ 'action' => 'upload', 'filekey' => $filekey, 'filename' => $fileName, diff --git a/tests/phpunit/includes/api/query/ApiQueryBlocksTest.php b/tests/phpunit/includes/api/query/ApiQueryBlocksTest.php index be27b02f088..bad71d03c79 100644 --- a/tests/phpunit/includes/api/query/ApiQueryBlocksTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryBlocksTest.php @@ -20,7 +20,7 @@ class ApiQueryBlocksTest extends ApiTestCase { ]; public function testExecute() { - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'list' => 'blocks', ] ); @@ -40,7 +40,7 @@ class ApiQueryBlocksTest extends ApiTestCase { $this->getServiceContainer()->getDatabaseBlockStore()->insertBlock( $block ); - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'list' => 'blocks', ] ); @@ -69,7 +69,7 @@ class ApiQueryBlocksTest extends ApiTestCase { $this->getServiceContainer()->getDatabaseBlockStore()->insertBlock( $block ); - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'list' => 'blocks', ] ); @@ -140,7 +140,7 @@ class ApiQueryBlocksTest extends ApiTestCase { ] ); // Test without requesting restrictions. - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'list' => 'blocks', ] ); @@ -154,7 +154,7 @@ class ApiQueryBlocksTest extends ApiTestCase { $this->assertArrayNotHasKey( 'restrictions', $data['query']['blocks'][0] ); // Test requesting the restrictions. - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'list' => 'blocks', 'bkprop' => 'id|user|expiry|restrictions' diff --git a/tests/phpunit/includes/api/query/ApiQueryInfoTest.php b/tests/phpunit/includes/api/query/ApiQueryInfoTest.php index ac8c462afd1..b73f26ede58 100644 --- a/tests/phpunit/includes/api/query/ApiQueryInfoTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryInfoTest.php @@ -46,7 +46,7 @@ class ApiQueryInfoTest extends ApiTestCase { '2011-04-01T00:00:00Z' ); - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'prop' => 'info', 'inprop' => 'watched|notificationtimestamp', @@ -83,7 +83,7 @@ class ApiQueryInfoTest extends ApiTestCase { $page = $this->getExistingTestPage( 'Pluto' ); $title = $page->getTitle(); - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'prop' => 'info', 'titles' => $title->getText(), @@ -108,7 +108,7 @@ class ApiQueryInfoTest extends ApiTestCase { $page = $this->getExistingTestPage( 'Pluto' ); $title = $page->getTitle(); - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'prop' => 'info', 'titles' => $title->getText(), @@ -133,7 +133,7 @@ class ApiQueryInfoTest extends ApiTestCase { $page = $this->getExistingTestPage( 'Pluto' ); $title = $page->getTitle(); - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'prop' => 'info', 'titles' => $title->getText(), @@ -175,7 +175,7 @@ class ApiQueryInfoTest extends ApiTestCase { $page = $this->getExistingTestPage( 'Pluto' ); $title = $page->getTitle(); - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'prop' => 'info', 'titles' => $title->getText(), @@ -214,7 +214,7 @@ class ApiQueryInfoTest extends ApiTestCase { // Make sure it doesn't exist $this->getNonexistingTestPage( $title2 ); - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'prop' => 'info', 'titles' => $title->getPrefixedText() . '|' . $title2->getPrefixedText(), @@ -248,7 +248,7 @@ class ApiQueryInfoTest extends ApiTestCase { * @covers ::extractPageInfo */ public function testDisplayTitle() { - list( $data ) = $this->doApiRequest( [ + [ $data ] = $this->doApiRequest( [ 'action' => 'query', 'prop' => 'info', 'inprop' => 'displaytitle', diff --git a/tests/phpunit/includes/api/query/ApiQueryLanguageinfoTest.php b/tests/phpunit/includes/api/query/ApiQueryLanguageinfoTest.php index d77de05e409..304cbe20bfa 100644 --- a/tests/phpunit/includes/api/query/ApiQueryLanguageinfoTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryLanguageinfoTest.php @@ -95,7 +95,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { * @dataProvider provideTestAllPropsForSingleLanguage */ public function testAllPropsForSingleLanguage( string $langCode, array $expected ) { - list( $response, $continue ) = $this->doQuery( [ + [ $response, $continue ] = $this->doQuery( [ 'liprop' => 'code|bcp47|dir|autonym|name|fallbacks|variants|variantnames', 'licode' => $langCode, ] ); @@ -104,7 +104,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { } public function testNameInOtherLanguageForSingleLanguage() { - list( $response, $continue ) = $this->doQuery( [ + [ $response, $continue ] = $this->doQuery( [ 'liprop' => 'name', 'licode' => 'de', 'uselang' => 'pt', @@ -119,7 +119,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { return $time += 0.75; } ); - list( $response, $continue ) = $this->doQuery( [] ); + [ $response, $continue ] = $this->doQuery( [] ); $this->assertCount( 2, $response ); $this->assertArrayHasKey( 'licontinue', $continue ); @@ -131,7 +131,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { return $time += 1.5; } ); - list( $response, $continue ) = $this->doQuery( [ + [ $response, $continue ] = $this->doQuery( [ 'licode' => 'de', ] ); @@ -145,7 +145,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { } ); $params = [ 'licode' => 'en|ru|zh|de|yue' ]; - list( $response, $continue ) = $this->doQuery( $params ); + [ $response, $continue ] = $this->doQuery( $params ); $this->assertCount( 2, $response ); $this->assertArrayHasKey( 'licontinue', $continue ); @@ -153,7 +153,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { $time = 0; $params = $continue + $params; - list( $response, $continue ) = $this->doQuery( $params ); + [ $response, $continue ] = $this->doQuery( $params ); $this->assertCount( 2, $response ); $this->assertArrayHasKey( 'licontinue', $continue ); @@ -161,7 +161,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { $time = 0; $params = $continue + $params; - list( $response, $continue ) = $this->doQuery( $params ); + [ $response, $continue ] = $this->doQuery( $params ); $this->assertCount( 1, $response ); $this->assertNull( $continue ); @@ -169,7 +169,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { } public function testResponseHasModulePathEvenIfEmpty() { - list( $response, $continue ) = $this->doQuery( [ 'licode' => '' ] ); + [ $response, $continue ] = $this->doQuery( [ 'licode' => '' ] ); $this->assertSame( [], $response ); // the real test is that $res[0]['query']['languageinfo'] in doQuery() didnโ€™t fail } diff --git a/tests/phpunit/includes/api/query/ApiQuerySearchTest.php b/tests/phpunit/includes/api/query/ApiQuerySearchTest.php index 7da9204f7b9..05802e5bc52 100644 --- a/tests/phpunit/includes/api/query/ApiQuerySearchTest.php +++ b/tests/phpunit/includes/api/query/ApiQuerySearchTest.php @@ -38,7 +38,7 @@ class ApiQuerySearchTest extends ApiTestCase { */ public function testSearchResults( $expect, $hits, array $params = [] ) { MockSearchEngine::addMockResults( 'my query', $hits ); - list( $response, $request ) = $this->doApiRequest( $params + [ + [ $response, $request ] = $this->doApiRequest( $params + [ 'action' => 'query', 'list' => 'search', 'srsearch' => 'my query', @@ -71,7 +71,7 @@ class ApiQuerySearchTest extends ApiTestCase { */ public function testInterwikiResults( $expect, $hits, array $params = [] ) { MockSearchEngine::setMockInterwikiResults( $hits ); - list( $response, $request ) = $this->doApiRequest( $params + [ + [ $response, $request ] = $this->doApiRequest( $params + [ 'action' => 'query', 'list' => 'search', 'srsearch' => 'my query', diff --git a/tests/phpunit/includes/api/query/ApiQueryTestBase.php b/tests/phpunit/includes/api/query/ApiQueryTestBase.php index 77527641b3a..e2f8f046f72 100644 --- a/tests/phpunit/includes/api/query/ApiQueryTestBase.php +++ b/tests/phpunit/includes/api/query/ApiQueryTestBase.php @@ -42,7 +42,7 @@ STR; $request = []; $expected = []; foreach ( $arrays as $array ) { - list( $req, $exp ) = $this->validateRequestExpectedPair( $array ); + [ $req, $exp ] = $this->validateRequestExpectedPair( $array ); $request = array_merge_recursive( $request, $req ); $this->mergeExpected( $expected, $exp ); } @@ -97,7 +97,7 @@ STR; protected function check( $values, array $session = null, $appendModule = false, User $user = null ) { - list( $req, $exp ) = $this->validateRequestExpectedPair( $values ); + [ $req, $exp ] = $this->validateRequestExpectedPair( $values ); if ( !array_key_exists( 'action', $req ) ) { $req['action'] = 'query'; } diff --git a/tests/phpunit/includes/auth/AuthManagerTest.php b/tests/phpunit/includes/auth/AuthManagerTest.php index 08e2b386970..79b0a392f94 100644 --- a/tests/phpunit/includes/auth/AuthManagerTest.php +++ b/tests/phpunit/includes/auth/AuthManagerTest.php @@ -350,11 +350,11 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase { public function testCanAuthenticateNow() { $this->initializeManager(); - list( $provider, $reset ) = $this->getMockSessionProvider( false ); + [ $provider, $reset ] = $this->getMockSessionProvider( false ); $this->assertFalse( $this->manager->canAuthenticateNow() ); ScopedCallback::consume( $reset ); - list( $provider, $reset ) = $this->getMockSessionProvider( true ); + [ $provider, $reset ] = $this->getMockSessionProvider( true ); $this->assertTrue( $this->manager->canAuthenticateNow() ); ScopedCallback::consume( $reset ); } @@ -399,7 +399,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase { $provideUser = null; $reauth = $mutableSession ? AuthManager::SEC_REAUTH : AuthManager::SEC_FAIL; - list( $provider, $reset ) = $this->getMockSessionProvider( + [ $provider, $reset ] = $this->getMockSessionProvider( $mutableSession, [ 'provideSessionInfo' ] ); $provider->method( 'provideSessionInfo' ) @@ -845,7 +845,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase { $this->initializeManager(); // Immutable session - list( $provider, $reset ) = $this->getMockSessionProvider( false ); + [ $provider, $reset ] = $this->getMockSessionProvider( false ); $this->hook( 'UserLoggedIn', UserLoggedInHook::class, $this->never() ); $this->request->getSession()->setSecret( 'AuthManager::authnState', 'test' ); try { diff --git a/tests/phpunit/includes/block/BlockRestrictionStoreTest.php b/tests/phpunit/includes/block/BlockRestrictionStoreTest.php index 23e0164c99b..75d68713a20 100644 --- a/tests/phpunit/includes/block/BlockRestrictionStoreTest.php +++ b/tests/phpunit/includes/block/BlockRestrictionStoreTest.php @@ -114,7 +114,7 @@ class BlockRestrictionStoreTest extends \MediaWikiLangTestCase { $restrictions = $this->blockRestrictionStore->loadByBlockId( $block->getId() ); - list( $pageRestriction ) = $restrictions; + [ $pageRestriction ] = $restrictions; $this->assertInstanceOf( PageRestriction::class, $pageRestriction ); $this->assertEquals( $block->getId(), $pageRestriction->getBlockId() ); $this->assertEquals( $page->getId(), $pageRestriction->getValue() ); @@ -136,7 +136,7 @@ class BlockRestrictionStoreTest extends \MediaWikiLangTestCase { $restrictions = $this->blockRestrictionStore->loadByBlockId( $block->getId() ); - list( $namespaceRestriction ) = $restrictions; + [ $namespaceRestriction ] = $restrictions; $this->assertInstanceOf( NamespaceRestriction::class, $namespaceRestriction ); $this->assertEquals( $block->getId(), $namespaceRestriction->getBlockId() ); $this->assertSame( NS_USER, $namespaceRestriction->getValue() ); diff --git a/tests/phpunit/includes/config/TestAllServiceOptionsUsed.php b/tests/phpunit/includes/config/TestAllServiceOptionsUsed.php index 6f0ccd94d15..b96e9075026 100644 --- a/tests/phpunit/includes/config/TestAllServiceOptionsUsed.php +++ b/tests/phpunit/includes/config/TestAllServiceOptionsUsed.php @@ -27,7 +27,7 @@ trait TestAllServiceOptionsUsed { 'for TestAllServiceOptionsUsed to work.' ); - list( $expected, $actual ) = self::$serviceOptionsAccessLog; + [ $expected, $actual ] = self::$serviceOptionsAccessLog; $expected = array_diff( $expected, $expectedUnused ); diff --git a/tests/phpunit/includes/deferred/LinksUpdateTest.php b/tests/phpunit/includes/deferred/LinksUpdateTest.php index bbdc52b127d..8ce88329bac 100644 --- a/tests/phpunit/includes/deferred/LinksUpdateTest.php +++ b/tests/phpunit/includes/deferred/LinksUpdateTest.php @@ -99,7 +99,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { public function testUpdate_pagelinks() { /** @var Title $t */ /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addLink( Title::newFromText( "Foo" ) ); $po->addLink( Title::newFromText( "Bar" ) ); @@ -152,7 +152,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { } public function testUpdate_pagelinks_move() { - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addLink( Title::newFromText( "Foo" ) ); $this->assertLinksUpdate( @@ -166,7 +166,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { ] ); - list( $t, $po ) = $this->makeTitleAndParserOutput( "User:Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "User:Testing", self::$testingPageId ); $po->addLink( Title::newFromText( "Foo" ) ); $this->assertMoveLinksUpdate( $t, @@ -188,7 +188,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { */ public function testUpdate_externallinks() { /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addExternalLink( "http://testing.com/wiki/Foo" ); $po->addExternalLink( "http://testing.com/wiki/Bar" ); @@ -241,7 +241,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { /** @var ParserOutput $po */ $this->overrideConfigValue( MainConfigNames::CategoryCollation, 'uppercase' ); - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addCategory( "Foo", "FOO" ); $po->addCategory( "Bar", "BAR" ); @@ -269,7 +269,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { ] ); - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addCategory( "Bar", "Bar" ); $po->addCategory( "Baz", "Baz" ); @@ -395,7 +395,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { $this->overrideConfigValue( MainConfigNames::CategoryCollation, 'uppercase' ); /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Old", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Old", self::$testingPageId ); $po->addCategory( "Bar", "BAR" ); $po->addCategory( "Foo", "FOO" ); @@ -424,7 +424,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { ); /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "New", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "New", self::$testingPageId ); $po->addCategory( "Bar", "BAR" ); $po->addCategory( "Foo", "FOO" ); @@ -490,7 +490,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { */ public function testUpdate_iwlinks() { /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $target1 = Title::makeTitleSafe( NS_MAIN, "T1", '', 'linksupdatetest' ); $target2 = Title::makeTitleSafe( NS_MAIN, "T2", '', 'linksupdatetest' ); @@ -511,7 +511,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { ); /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addInterwikiLink( $target2 ); $po->addInterwikiLink( $target3 ); @@ -534,7 +534,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { */ public function testUpdate_templatelinks() { /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $linkTargetLookup = MediaWikiServices::getInstance()->getLinkTargetLookup(); $target1 = Title::newFromText( "Template:T1" ); @@ -557,7 +557,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { ); /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addTemplate( $target2, 23, 42 ); $po->addTemplate( $target3, 23, 42 ); @@ -580,7 +580,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { */ public function testUpdate_imagelinks() { /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addImage( "1.png" ); $po->addImage( "2.png" ); @@ -595,7 +595,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { ); /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addImage( "2.png" ); $po->addImage( "3.png" ); @@ -611,7 +611,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { } public function testUpdate_imagelinks_move() { - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addImage( "1.png" ); $po->addImage( "2.png" ); @@ -627,7 +627,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { ); $oldT = $t; - list( $t, $po ) = $this->makeTitleAndParserOutput( "User:Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "User:Testing", self::$testingPageId ); $po->addImage( "1.png" ); $po->addImage( "2.png" ); @@ -650,7 +650,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { $this->overrideConfigValue( MainConfigNames::CapitalLinks, true ); /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addLanguageLink( 'De:1' ); $po->addLanguageLink( 'En:1' ); @@ -669,7 +669,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { ] ); - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addLanguageLink( 'En:2' ); $po->addLanguageLink( 'Fr:1' ); @@ -691,7 +691,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { */ public function testUpdate_page_props() { /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $fields = [ 'pp_propname', 'pp_value', 'pp_sortkey' ]; $cond = 'pp_page = ' . self::$testingPageId; @@ -706,7 +706,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { ] ); - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $expected = []; $po->setPageProperty( "bool", true ); @@ -739,7 +739,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { $t, $po, 'page_props', $fields, 'pp_page = ' . self::$testingPageId, $expected ); $expectedAssoc = []; - foreach ( $expected as list( $name, $value ) ) { + foreach ( $expected as [ $name, $value ] ) { $expectedAssoc[$name] = $value; } $this->assertArrayEquals( $expectedAssoc, $update->getAddedProperties() ); @@ -806,7 +806,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { } public function testIsRecursive() { - list( $title, $po ) = $this->makeTitleAndParserOutput( 'Test', 1 ); + [ $title, $po ] = $this->makeTitleAndParserOutput( 'Test', 1 ); $linksUpdate = new LinksUpdate( $title, $po ); $this->assertTrue( $linksUpdate->isRecursive(), 'LinksUpdate is recursive by default' ); @@ -825,7 +825,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { */ public function testNullEdit() { /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addCategory( 'Test', 'Test' ); $po->addExternalLink( 'http://www.example.com/' ); $po->addImage( 'Test' ); @@ -876,7 +876,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { $i = 123; /** @var ParserOutput $po */ - list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addCategory( $s, $s ); $po->addExternalLink( $s ); $po->addImage( $s ); @@ -905,13 +905,13 @@ class LinksUpdateTest extends MediaWikiLangTestCase { * Integration test for numeric category names (T301433) */ public function testNumericCategory() { - list( $t, $po ) = $this->makeTitleAndParserOutput( "Test 1", self::$testingPageId + 1 ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Test 1", self::$testingPageId + 1 ); $po->addCategory( '123a', '123a' ); $update = new LinksUpdate( $t, $po ); $update->setStrictTestMode(); $update->doUpdate(); - list( $t, $po ) = $this->makeTitleAndParserOutput( "Test 2", self::$testingPageId + 2 ); + [ $t, $po ] = $this->makeTitleAndParserOutput( "Test 2", self::$testingPageId + 2 ); $po->addCategory( '123', '123' ); $update = new LinksUpdate( $t, $po ); $update->setStrictTestMode(); diff --git a/tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php b/tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php index c9cfe36e0e4..329c89c1785 100644 --- a/tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php +++ b/tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php @@ -16,7 +16,7 @@ class FileBackendDBRepoWrapperTest extends MediaWikiIntegrationTestCase { $originalPath, $expectedBackendPath, $message ) { - list( $dbMock, $backendMock, $wrapperMock ) = $mocks; + [ $dbMock, $backendMock, $wrapperMock ] = $mocks; $dbMock->expects( $dbReadsExpected ) ->method( 'selectField' ) @@ -87,7 +87,7 @@ class FileBackendDBRepoWrapperTest extends MediaWikiIntegrationTestCase { * @covers FileBackendDBRepoWrapper::getFileContentsMulti */ public function testGetFileContentsMulti() { - list( $dbMock, $backendMock, $wrapperMock ) = $this->getMocks(); + [ $dbMock, $backendMock, $wrapperMock ] = $this->getMocks(); $sha1Path = 'mwstore://' . $this->backendName . '/' . $this->repoName . '-original/9/6/2/96246614d75ba1703bdfd5d7660bb57407aaf5d9'; diff --git a/tests/phpunit/includes/parser/StripStateTest.php b/tests/phpunit/includes/parser/StripStateTest.php index c410aa36ae5..11a27ceb963 100644 --- a/tests/phpunit/includes/parser/StripStateTest.php +++ b/tests/phpunit/includes/parser/StripStateTest.php @@ -122,7 +122,7 @@ class StripStateTest extends MediaWikiIntegrationTestCase { $text = $ss->unstripNoWiki( $text ); $report = $ss->getLimitReport(); $messages = []; - foreach ( $report as list( $msg, $params ) ) { + foreach ( $report as [ $msg, $params ] ) { $messages[$msg] = $params; } $this->assertSame( [ $depth - 1, 5 ], $messages['limitreport-unstrip-depth'] ); diff --git a/tests/phpunit/includes/session/SessionTest.php b/tests/phpunit/includes/session/SessionTest.php index 006dbeae593..7d6b6501f43 100644 --- a/tests/phpunit/includes/session/SessionTest.php +++ b/tests/phpunit/includes/session/SessionTest.php @@ -91,7 +91,7 @@ class SessionTest extends MediaWikiIntegrationTestCase { // Unserializable data $iv = random_bytes( 16 ); - list( $encKey, $hmacKey ) = TestingAccessWrapper::newFromObject( $session )->getSecretKeys(); + [ $encKey, $hmacKey ] = TestingAccessWrapper::newFromObject( $session )->getSecretKeys(); $ciphertext = openssl_encrypt( 'foobar', 'aes-256-ctr', $encKey, OPENSSL_RAW_DATA, $iv ); $sealed = base64_encode( $iv ) . '.' . base64_encode( $ciphertext ); $hmac = hash_hmac( 'sha256', $sealed, $hmacKey, true ); diff --git a/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php b/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php index 9d2ab1dd511..4633c6fbeaa 100644 --- a/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php +++ b/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php @@ -115,7 +115,7 @@ class SpecialPageFactoryTest extends MediaWikiIntegrationTestCase { public function testResolveAlias() { $this->overrideConfigValue( MainConfigNames::LanguageCode, 'de' ); - list( $name, $param ) = $this->getFactory()->resolveAlias( 'Spezialseiten/Foo' ); + [ $name, $param ] = $this->getFactory()->resolveAlias( 'Spezialseiten/Foo' ); $this->assertEquals( 'Specialpages', $name ); $this->assertEquals( 'Foo', $param ); } @@ -194,7 +194,7 @@ class SpecialPageFactoryTest extends MediaWikiIntegrationTestCase { } ); $reset = new ScopedCallback( 'restore_error_handler' ); - list( $name, /*...*/ ) = $this->getFactory()->resolveAlias( $alias ); + [ $name, /*...*/ ] = $this->getFactory()->resolveAlias( $alias ); $this->assertEquals( $expectedName, $name, "$test: Alias to name" ); $result = $this->getFactory()->getLocalNameFor( $name ); $this->assertEquals( $expectedAlias, $result, "$test: Alias to name to alias" ); diff --git a/tests/phpunit/includes/specials/SpecialBlankPageTest.php b/tests/phpunit/includes/specials/SpecialBlankPageTest.php index 3670672b3ac..c2e4f0c3edb 100644 --- a/tests/phpunit/includes/specials/SpecialBlankPageTest.php +++ b/tests/phpunit/includes/specials/SpecialBlankPageTest.php @@ -23,7 +23,7 @@ class SpecialBlankPageTest extends SpecialPageTestBase { } public function testHasWikiMsg() { - list( $html, ) = $this->executeSpecialPage(); + [ $html, ] = $this->executeSpecialPage(); $this->assertStringContainsString( '(intentionallyblankpage)', $html ); } diff --git a/tests/phpunit/includes/specials/SpecialBlockTest.php b/tests/phpunit/includes/specials/SpecialBlockTest.php index fb25d7deac5..3f7da14e854 100644 --- a/tests/phpunit/includes/specials/SpecialBlockTest.php +++ b/tests/phpunit/includes/specials/SpecialBlockTest.php @@ -868,7 +868,7 @@ class SpecialBlockTest extends SpecialPageTestBase { public function testGetTargetAndType( $par, $requestData, $expectedTarget ) { $request = $requestData ? new FauxRequest( $requestData ) : null; $page = $this->newSpecialPage(); - list( $target, $type ) = $page->getTargetAndType( $par, $request ); + [ $target, $type ] = $page->getTargetAndType( $par, $request ); $this->assertSame( $expectedTarget, $target ); } diff --git a/tests/phpunit/includes/specials/SpecialBooksourcesTest.php b/tests/phpunit/includes/specials/SpecialBooksourcesTest.php index 18408cf2191..e7f040db6e7 100644 --- a/tests/phpunit/includes/specials/SpecialBooksourcesTest.php +++ b/tests/phpunit/includes/specials/SpecialBooksourcesTest.php @@ -47,9 +47,9 @@ class SpecialBooksourcesTest extends SpecialPageTestBase { * @covers SpecialBookSources::execute */ public function testExecute() { - list( $html, ) = $this->executeSpecialPage( 'Invalid', null, 'qqx' ); + [ $html, ] = $this->executeSpecialPage( 'Invalid', null, 'qqx' ); $this->assertStringContainsString( '(booksources-invalid-isbn)', $html ); - list( $html, ) = $this->executeSpecialPage( '0-7475-3269-9', null, 'qqx' ); + [ $html, ] = $this->executeSpecialPage( '0-7475-3269-9', null, 'qqx' ); $this->assertStringNotContainsString( '(booksources-invalid-isbn)', $html ); $this->assertStringContainsString( '(booksources-text)', $html ); } diff --git a/tests/phpunit/includes/specials/SpecialContributeTest.php b/tests/phpunit/includes/specials/SpecialContributeTest.php index c9ce32b765e..86df2f4f93b 100644 --- a/tests/phpunit/includes/specials/SpecialContributeTest.php +++ b/tests/phpunit/includes/specials/SpecialContributeTest.php @@ -22,7 +22,7 @@ class SpecialContributeTest extends SpecialPageTestBase { public function testExecute() { try { // Now only enabled for minerva skin - list( $html ) = $this->executeSpecialPage( $this->admin->getUser()->getName(), null, 'qqx', $this->admin, true ); + [ $html ] = $this->executeSpecialPage( $this->admin->getUser()->getName(), null, 'qqx', $this->admin, true ); $this->assertStringContainsString( '
', $html ); $this->assertStringContainsString( '
', $html ); } catch ( Exception $e ) { diff --git a/tests/phpunit/includes/specials/SpecialContributionsTest.php b/tests/phpunit/includes/specials/SpecialContributionsTest.php index 771580561e8..e4cc591fa02 100644 --- a/tests/phpunit/includes/specials/SpecialContributionsTest.php +++ b/tests/phpunit/includes/specials/SpecialContributionsTest.php @@ -41,7 +41,7 @@ class SpecialContributionsTest extends SpecialPageTestBase { * @dataProvider provideTestExecuteRange */ public function testExecuteRange( $username, $shouldShowLinks ) { - list( $html ) = $this->executeSpecialPage( $username, null, 'qqx', $this->admin, true ); + [ $html ] = $this->executeSpecialPage( $username, null, 'qqx', $this->admin, true ); if ( $shouldShowLinks ) { $this->assertStringContainsString( 'blocklink', $html ); @@ -56,7 +56,7 @@ class SpecialContributionsTest extends SpecialPageTestBase { * @dataProvider provideTestExecuteNonRange */ public function testExecuteNonRange( $username, $shouldShowLinks ) { - list( $html ) = $this->executeSpecialPage( $username, null, 'qqx', $this->admin, true ); + [ $html ] = $this->executeSpecialPage( $username, null, 'qqx', $this->admin, true ); if ( $shouldShowLinks ) { $this->assertStringContainsString( 'blocklink', $html ); diff --git a/tests/phpunit/includes/specials/SpecialEditWatchlistTest.php b/tests/phpunit/includes/specials/SpecialEditWatchlistTest.php index 18e2a669527..ab7d96a195b 100644 --- a/tests/phpunit/includes/specials/SpecialEditWatchlistTest.php +++ b/tests/phpunit/includes/specials/SpecialEditWatchlistTest.php @@ -34,13 +34,13 @@ class SpecialEditWatchlistTest extends SpecialPageTestBase { public function testRootPage_displaysExplanationMessage() { $user = new TestUser( __METHOD__ ); - list( $html, ) = $this->executeSpecialPage( '', null, 'qqx', $user->getUser() ); + [ $html, ] = $this->executeSpecialPage( '', null, 'qqx', $user->getUser() ); $this->assertStringContainsString( '(watchlistedit-normal-explain)', $html ); } public function testClearPage_hasClearButtonForm() { $user = new TestUser( __METHOD__ ); - list( $html, ) = $this->executeSpecialPage( 'clear', null, 'qqx', $user->getUser() ); + [ $html, ] = $this->executeSpecialPage( 'clear', null, 'qqx', $user->getUser() ); $this->assertMatchesRegularExpression( '/
executeSpecialPage( 'raw', null, 'qqx', $user->getUser() ); + [ $html, ] = $this->executeSpecialPage( 'raw', null, 'qqx', $user->getUser() ); $this->assertStringContainsString( '
executeSpecialPage( + [ $html, ] = $this->executeSpecialPage( '', // There is no 13th month new FauxRequest( [ 'wpdate' => '2018-13-01' ] ), diff --git a/tests/phpunit/includes/specials/SpecialMuteTest.php b/tests/phpunit/includes/specials/SpecialMuteTest.php index 71d6210c8c1..5871a1f25e3 100644 --- a/tests/phpunit/includes/specials/SpecialMuteTest.php +++ b/tests/phpunit/includes/specials/SpecialMuteTest.php @@ -81,7 +81,7 @@ class SpecialMuteTest extends SpecialPageTestBase { $loggedInUser->saveSettings(); $fauxRequest = new FauxRequest( [ 'wpemail-blacklist' => true ], true ); - list( $html, ) = $this->executeSpecialPage( + [ $html, ] = $this->executeSpecialPage( $targetUser->getName(), $fauxRequest, 'qqx', $loggedInUser ); @@ -104,7 +104,7 @@ class SpecialMuteTest extends SpecialPageTestBase { $loggedInUser->saveSettings(); $fauxRequest = new FauxRequest( [ 'wpemail-blacklist' => false ], true ); - list( $html, ) = $this->executeSpecialPage( + [ $html, ] = $this->executeSpecialPage( $targetUser->getName(), $fauxRequest, 'qqx', $loggedInUser ); diff --git a/tests/phpunit/includes/specials/SpecialPageDataTest.php b/tests/phpunit/includes/specials/SpecialPageDataTest.php index 573f3d8b80b..09c6ce78de3 100644 --- a/tests/phpunit/includes/specials/SpecialPageDataTest.php +++ b/tests/phpunit/includes/specials/SpecialPageDataTest.php @@ -118,7 +118,7 @@ class SpecialPageDataTest extends SpecialPageTestBase { try { /** @var FauxResponse $response */ - list( $output, $response ) = $this->executeSpecialPage( $subpage, $request ); + [ $output, $response ] = $this->executeSpecialPage( $subpage, $request ); $this->assertEquals( $expCode, $response->getStatusCode(), "status code" ); $this->assertMatchesRegularExpression( $expRegExp, $output, "output" ); @@ -139,7 +139,7 @@ class SpecialPageDataTest extends SpecialPageTestBase { $request = new FauxRequest(); $request->response()->header( 'Status: 200 OK', true, 200 ); // init/reset - list( $output, ) = $this->executeSpecialPage( '', $request ); + [ $output, ] = $this->executeSpecialPage( '', $request ); $this->assertStringContainsString( '(pagedata-text)', $output ); } diff --git a/tests/phpunit/includes/specials/SpecialUnblockTest.php b/tests/phpunit/includes/specials/SpecialUnblockTest.php index 41b6c7314da..9ccc5016342 100644 --- a/tests/phpunit/includes/specials/SpecialUnblockTest.php +++ b/tests/phpunit/includes/specials/SpecialUnblockTest.php @@ -95,7 +95,7 @@ class SpecialUnblockTest extends SpecialPageTestBase { 'wpTarget' => $target, 'wpReason' => '', ], true ); - list( $html, ) = $this->executeSpecialPage( '', $request, 'qqx', $performer ); + [ $html, ] = $this->executeSpecialPage( '', $request, 'qqx', $performer ); $this->assertStringContainsString( $expected, $html ); } @@ -146,7 +146,7 @@ class SpecialUnblockTest extends SpecialPageTestBase { 'wpTarget' => $performer->getName(), 'wpReason' => '', ], true ); - list( $html, ) = $this->executeSpecialPage( '', $request, 'qqx', $performer ); + [ $html, ] = $this->executeSpecialPage( '', $request, 'qqx', $performer ); $this->assertStringContainsString( 'ipbnounblockself', $html ); } diff --git a/tests/phpunit/includes/specials/SpecialWatchlistTest.php b/tests/phpunit/includes/specials/SpecialWatchlistTest.php index 38f6da67a57..90368a805ad 100644 --- a/tests/phpunit/includes/specials/SpecialWatchlistTest.php +++ b/tests/phpunit/includes/specials/SpecialWatchlistTest.php @@ -61,7 +61,7 @@ class SpecialWatchlistTest extends SpecialPageTestBase { public function testUserWithNoWatchedItems_displaysNoWatchlistMessage() { $user = new TestUser( __METHOD__ ); - list( $html, ) = $this->executeSpecialPage( '', null, 'qqx', $user->getUser() ); + [ $html, ] = $this->executeSpecialPage( '', null, 'qqx', $user->getUser() ); $this->assertStringContainsString( '(nowatchlist)', $html ); } diff --git a/tests/phpunit/includes/upload/UploadBaseTest.php b/tests/phpunit/includes/upload/UploadBaseTest.php index 9b42136d220..e9205506e5f 100644 --- a/tests/phpunit/includes/upload/UploadBaseTest.php +++ b/tests/phpunit/includes/upload/UploadBaseTest.php @@ -134,7 +134,7 @@ class UploadBaseTest extends MediaWikiIntegrationTestCase { * @dataProvider provideCheckSvgScriptCallback */ public function testCheckSvgScriptCallback( $svg, $wellFormed, $filterMatch, $message ) { - list( $formed, $match ) = $this->upload->checkSvgString( $svg ); + [ $formed, $match ] = $this->upload->checkSvgString( $svg ); $this->assertSame( $wellFormed, $formed, $message . " (well-formed)" ); $this->assertSame( $filterMatch, $match, $message . " (filter match)" ); } diff --git a/tests/phpunit/integration/includes/CommentFormatter/CommentFormatterTest.php b/tests/phpunit/integration/includes/CommentFormatter/CommentFormatterTest.php index b27127abe83..0d5021e9a7d 100644 --- a/tests/phpunit/integration/includes/CommentFormatter/CommentFormatterTest.php +++ b/tests/phpunit/integration/includes/CommentFormatter/CommentFormatterTest.php @@ -285,7 +285,7 @@ class CommentFormatterTest extends MediaWikiIntegrationTestCase { public function testFormatRevision( $comment, $isPublic, $isDeleted, $isAllowed, $useParentheses, $expected ) { - list( $rev, $authority ) = $this->makeRevisionAndAuthority( + [ $rev, $authority ] = $this->makeRevisionAndAuthority( $comment, $isDeleted, $isAllowed ); $formatter = $this->newCommentFormatter(); $result = $formatter->formatRevision( @@ -304,7 +304,7 @@ class CommentFormatterTest extends MediaWikiIntegrationTestCase { public function testFormatRevisions( $comment, $isPublic, $isDeleted, $isAllowed, $useParentheses, $expected ) { - list( $rev, $authority ) = $this->makeRevisionAndAuthority( + [ $rev, $authority ] = $this->makeRevisionAndAuthority( $comment, $isDeleted, $isAllowed ); $formatter = $this->newCommentFormatter(); $result = $formatter->formatRevisions( @@ -320,7 +320,7 @@ class CommentFormatterTest extends MediaWikiIntegrationTestCase { } public function testFormatRevisionsById() { - list( $rev, $authority ) = $this->makeRevisionAndAuthority( + [ $rev, $authority ] = $this->makeRevisionAndAuthority( 'hello', false, false ); $formatter = $this->newCommentFormatter(); $result = $formatter->formatRevisions( @@ -344,7 +344,7 @@ class CommentFormatterTest extends MediaWikiIntegrationTestCase { public function testCreateRevisionBatch( $comment, $isPublic, $isDeleted, $isAllowed, $useParentheses, $expected ) { - list( $rev, $authority ) = $this->makeRevisionAndAuthority( + [ $rev, $authority ] = $this->makeRevisionAndAuthority( $comment, $isDeleted, $isAllowed ); $formatter = $this->newCommentFormatter(); $result = $formatter->createRevisionBatch() @@ -360,7 +360,7 @@ class CommentFormatterTest extends MediaWikiIntegrationTestCase { } public function testCreateRevisionBatchById() { - list( $rev, $authority ) = $this->makeRevisionAndAuthority( + [ $rev, $authority ] = $this->makeRevisionAndAuthority( 'hello', false, false ); $formatter = $this->newCommentFormatter(); $result = $formatter->createRevisionBatch() diff --git a/tests/phpunit/languages/LanguageIntegrationTest.php b/tests/phpunit/languages/LanguageIntegrationTest.php index 7c4ca22f1e5..b5783725730 100644 --- a/tests/phpunit/languages/LanguageIntegrationTest.php +++ b/tests/phpunit/languages/LanguageIntegrationTest.php @@ -1634,7 +1634,7 @@ class LanguageIntegrationTest extends LanguageClassesTestCase { public function testTranslateBlockExpiry( $expectedData, $str, $now, $desc ) { $lang = $this->getLang(); if ( is_array( $expectedData ) ) { - list( $func, $arg ) = $expectedData; + [ $func, $arg ] = $expectedData; $expected = $lang->$func( $arg ); } else { $expected = $expectedData; diff --git a/tests/phpunit/structure/ResourcesTest.php b/tests/phpunit/structure/ResourcesTest.php index 00e25642010..3b4ee35e230 100644 --- a/tests/phpunit/structure/ResourcesTest.php +++ b/tests/phpunit/structure/ResourcesTest.php @@ -20,7 +20,7 @@ use Wikimedia\TestingAccessWrapper; class ResourcesTest extends MediaWikiIntegrationTestCase { public function testStyleMedia() { - foreach ( self::provideMediaStylesheets() as list( $moduleName, $media, $filename, $css ) ) { + foreach ( self::provideMediaStylesheets() as [ $moduleName, $media, $filename, $css ] ) { $cssText = CSSMin::minify( $css->cssText ); $this->assertStringNotContainsString( diff --git a/tests/phpunit/structure/SuiteDirectoryTest.php b/tests/phpunit/structure/SuiteDirectoryTest.php index 13149a96c51..de469926566 100644 --- a/tests/phpunit/structure/SuiteDirectoryTest.php +++ b/tests/phpunit/structure/SuiteDirectoryTest.php @@ -70,7 +70,7 @@ class SuiteDirectoryTest extends PHPUnit\Framework\TestCase { } private function isDirectoryIncluded( $dir, array $suiteInfos ) { - foreach ( $suiteInfos as list( $generalDirs, $excludedDirs ) ) { + foreach ( $suiteInfos as [ $generalDirs, $excludedDirs ] ) { $found = false; foreach ( $generalDirs as $generalDir ) { if ( $this->isSameOrChildOfDirectory( $dir, $generalDir ) ) { diff --git a/tests/phpunit/unit/includes/Rest/HeaderContainerTest.php b/tests/phpunit/unit/includes/Rest/HeaderContainerTest.php index e65251e350f..68fa04fd47b 100644 --- a/tests/phpunit/unit/includes/Rest/HeaderContainerTest.php +++ b/tests/phpunit/unit/includes/Rest/HeaderContainerTest.php @@ -48,7 +48,7 @@ class HeaderContainerTest extends \MediaWikiUnitTestCase { /** @dataProvider provideSetHeader */ public function testSetHeader( $setOps, $headers, $lines ) { $hc = new HeaderContainer; - foreach ( $setOps as list( $name, $value ) ) { + foreach ( $setOps as [ $name, $value ] ) { $hc->setHeader( $name, $value ); } $this->assertSame( $headers, $hc->getHeaders() ); @@ -94,7 +94,7 @@ class HeaderContainerTest extends \MediaWikiUnitTestCase { /** @dataProvider provideAddHeader */ public function testAddHeader( $addOps, $headers, $lines ) { $hc = new HeaderContainer; - foreach ( $addOps as list( $name, $value ) ) { + foreach ( $addOps as [ $name, $value ] ) { $hc->addHeader( $name, $value ); } $this->assertSame( $headers, $hc->getHeaders() ); @@ -127,7 +127,7 @@ class HeaderContainerTest extends \MediaWikiUnitTestCase { /** @dataProvider provideRemoveHeader */ public function testRemoveHeader( $addOps, $removeOps, $headers, $lines ) { $hc = new HeaderContainer; - foreach ( $addOps as list( $name, $value ) ) { + foreach ( $addOps as [ $name, $value ] ) { $hc->addHeader( $name, $value ); } foreach ( $removeOps as $name ) { diff --git a/tests/phpunit/unit/includes/Settings/Cache/CachedSourceTest.php b/tests/phpunit/unit/includes/Settings/Cache/CachedSourceTest.php index 153a5bfe9d3..243c4fe558b 100644 --- a/tests/phpunit/unit/includes/Settings/Cache/CachedSourceTest.php +++ b/tests/phpunit/unit/includes/Settings/Cache/CachedSourceTest.php @@ -17,7 +17,7 @@ class CachedSourceTest extends TestCase { $hashKey = 'abc123'; $ttl = 123; - list( $cache, $key ) = $this->createCacheMock( $hashKey ); + [ $cache, $key ] = $this->createCacheMock( $hashKey ); $source = $this->createMock( CacheableSource::class ); $cacheSource = new CachedSource( $cache, $source ); @@ -69,7 +69,7 @@ class CachedSourceTest extends TestCase { $settings = [ 'config' => [ 'Foo' => 'value' ] ]; $hashKey = 'abc123'; - list( $cache, $key ) = $this->createCacheMock( $hashKey ); + [ $cache, $key ] = $this->createCacheMock( $hashKey ); $source = $this->createMock( CacheableSource::class ); $cacheSource = new CachedSource( $cache, $source ); @@ -111,7 +111,7 @@ class CachedSourceTest extends TestCase { $hashKey = 'abc123'; $expired = microtime( true ) - 1; - list( $cache, $key ) = $this->createCacheMock( $hashKey ); + [ $cache, $key ] = $this->createCacheMock( $hashKey ); $source = $this->createMock( CacheableSource::class ); $cacheSource = new CachedSource( $cache, $source ); @@ -150,7 +150,7 @@ class CachedSourceTest extends TestCase { $hashKey = 'abc123'; $expired = microtime( true ) - 1; - list( $cache, $key ) = $this->createCacheMock( $hashKey, [ 'lock' ] ); + [ $cache, $key ] = $this->createCacheMock( $hashKey, [ 'lock' ] ); $source = $this->createMock( CacheableSource::class ); $cacheSource = new CachedSource( $cache, $source ); diff --git a/tests/phpunit/unit/includes/block/BlockUtilsTest.php b/tests/phpunit/unit/includes/block/BlockUtilsTest.php index 8456960f948..866f4ef6ce3 100644 --- a/tests/phpunit/unit/includes/block/BlockUtilsTest.php +++ b/tests/phpunit/unit/includes/block/BlockUtilsTest.php @@ -93,7 +93,7 @@ class BlockUtilsTest extends MediaWikiUnitTestCase { $userIdentity = UserIdentityValue::newAnonymous( $ip ); $blockUtils = $this->getUtils(); - list( $target, $type ) = $blockUtils->parseBlockTarget( $ip ); + [ $target, $type ] = $blockUtils->parseBlockTarget( $ip ); $this->assertTrue( $userIdentity->equals( $target ) ); $this->assertSame( $type, AbstractBlock::TYPE_IP ); diff --git a/tests/phpunit/unit/includes/filebackend/HTTPFileStreamerTest.php b/tests/phpunit/unit/includes/filebackend/HTTPFileStreamerTest.php index bb025b62059..2e34f71d42b 100644 --- a/tests/phpunit/unit/includes/filebackend/HTTPFileStreamerTest.php +++ b/tests/phpunit/unit/includes/filebackend/HTTPFileStreamerTest.php @@ -9,7 +9,7 @@ class HTTPFileStreamerTest extends TestCase { * @dataProvider providePreprocessHeaders */ public function testPreprocessHeaders( array $input, array $expectedRaw, array $expectedOpt ) { - list( $actualRaw, $actualOpt ) = HTTPFileStreamer::preprocessHeaders( $input ); + [ $actualRaw, $actualOpt ] = HTTPFileStreamer::preprocessHeaders( $input ); $this->assertSame( $expectedRaw, $actualRaw ); $this->assertSame( $expectedOpt, $actualOpt ); } diff --git a/tests/phpunit/unit/includes/language/LanguageNameUtilsTestTrait.php b/tests/phpunit/unit/includes/language/LanguageNameUtilsTestTrait.php index ddbcd0cb7ee..767bf1fc502 100644 --- a/tests/phpunit/unit/includes/language/LanguageNameUtilsTestTrait.php +++ b/tests/phpunit/unit/includes/language/LanguageNameUtilsTestTrait.php @@ -522,7 +522,7 @@ trait LanguageNameUtilsTestTrait { public function provideExceptionFromInvalidCode() { $ret = []; - foreach ( static::provideIsValidBuiltInCode() as $desc => list( $code, $valid ) ) { + foreach ( static::provideIsValidBuiltInCode() as $desc => [ $code, $valid ] ) { if ( $valid ) { // Won't get an exception from this one continue; diff --git a/tests/phpunit/unit/includes/libs/ParamValidator/TypeDef/BooleanDefTest.php b/tests/phpunit/unit/includes/libs/ParamValidator/TypeDef/BooleanDefTest.php index 0dc24273261..04b49995d18 100644 --- a/tests/phpunit/unit/includes/libs/ParamValidator/TypeDef/BooleanDefTest.php +++ b/tests/phpunit/unit/includes/libs/ParamValidator/TypeDef/BooleanDefTest.php @@ -21,7 +21,7 @@ class BooleanDefTest extends TypeDefTestCase { [ BooleanDef::$TRUEVALS, true ], [ BooleanDef::$FALSEVALS, false ], [ [ '' ], false ], - ] as list( $vals, $expect ) ) { + ] as [ $vals, $expect ] ) { foreach ( $vals as $v ) { yield "Value '$v'" => [ $v, $expect ]; $v2 = ucfirst( $v ); diff --git a/tests/phpunit/unit/includes/libs/XhprofDataTest.php b/tests/phpunit/unit/includes/libs/XhprofDataTest.php index 81e189e60f4..ff162356e66 100644 --- a/tests/phpunit/unit/includes/libs/XhprofDataTest.php +++ b/tests/phpunit/unit/includes/libs/XhprofDataTest.php @@ -173,7 +173,7 @@ class XhprofDataTest extends PHPUnit\Framework\TestCase { $last = null; foreach ( $path as $key => $value ) { - list( $func, $call ) = XhprofData::splitKey( $key ); + [ $func, $call ] = XhprofData::splitKey( $key ); $this->assertSame( $last, $func ); $last = $call; } diff --git a/tests/phpunit/unit/includes/libs/objectcache/WANObjectCacheTest.php b/tests/phpunit/unit/includes/libs/objectcache/WANObjectCacheTest.php index f8ac107e71f..c67c3a5f002 100644 --- a/tests/phpunit/unit/includes/libs/objectcache/WANObjectCacheTest.php +++ b/tests/phpunit/unit/includes/libs/objectcache/WANObjectCacheTest.php @@ -43,7 +43,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::makeKey() */ public function testSetAndGet( $value, $ttl ) { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $curTTL = null; $asOf = null; @@ -105,7 +105,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::makeGlobalKey() */ public function testGetNotExists() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $key = $cache->makeGlobalKey( 'y', wfRandomString(), 'p' ); $curTTL = null; @@ -119,7 +119,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::set() */ public function testSetOver() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $key = wfRandomString(); for ( $i = 0; $i < 3; ++$i ) { @@ -156,7 +156,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @param bool $cacheable */ public function testStaleSet( $ago, $walltime, $cacheable ) { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $mockWallClock = 1549343530.0; $cache->setMockTime( $mockWallClock ); @@ -181,7 +181,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::getWithSetCallback */ public function testProcessCacheTTL() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $mockWallClock = 1549343530.0; $cache->setMockTime( $mockWallClock ); @@ -208,7 +208,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::makeTombstonePurgeValue */ public function testProcessCacheLruAndDelete() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $mockWallClock = 1549343530.0; $cache->setMockTime( $mockWallClock ); @@ -253,7 +253,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::getWithSetCallback */ public function testProcessCacheInterimKeys() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $mockWallClock = 1549343530.0; $cache->setMockTime( $mockWallClock ); @@ -294,7 +294,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::getWithSetCallback */ public function testProcessCacheNesting() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $mockWallClock = 1549343530.0; $cache->setMockTime( $mockWallClock ); @@ -358,7 +358,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @param array $extOpts */ public function testGetWithSetCallback( array $extOpts ) { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $key = wfRandomString(); $value = wfRandomString(); @@ -547,7 +547,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @param array $extOpts */ public function testGetWithSetCallback_touched( array $extOpts ) { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $mockWallClock = 1549343530.0; $cache->setMockTime( $mockWallClock ); @@ -716,7 +716,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @param array $extOpts */ public function testGetMultiWithSetCallback( array $extOpts ) { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $keyA = wfRandomString(); $keyB = wfRandomString(); @@ -976,7 +976,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @param array $extOpts */ public function testGetMultiWithUnionSetCallback( array $extOpts ) { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $wasSet = 0; $genFunc = static function ( array $ids, array &$ttls, array &$setOpts ) use ( @@ -1241,7 +1241,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @dataProvider provideCoalesceAndMcrouterSettings */ public function testLockTSE( array $params ) { - list( $cache, $bag ) = $this->newWanCache( $params ); + [ $cache, $bag ] = $this->newWanCache( $params ); $key = wfRandomString(); $value = wfRandomString(); @@ -1306,7 +1306,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @dataProvider provideCoalesceAndMcrouterSettings */ public function testLockTSESlow( array $params ) { - list( $cache, $bag ) = $this->newWanCache( $params ); + [ $cache, $bag ] = $this->newWanCache( $params ); $key = wfRandomString(); $key2 = wfRandomString(); $value = wfRandomString(); @@ -1396,7 +1396,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @dataProvider provideCoalesceAndMcrouterSettings */ public function testBusyValueBasic( array $params ) { - list( $cache, $bag ) = $this->newWanCache( $params ); + [ $cache, $bag ] = $this->newWanCache( $params ); $key = wfRandomString(); $value = wfRandomString(); $busyValue = wfRandomString(); @@ -1475,7 +1475,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @dataProvider getBusyValues_Provider */ public function testBusyValueTypes( $busyValue, $expected ) { - list( $cache, $bag ) = $this->newWanCache(); + [ $cache, $bag ] = $this->newWanCache(); $key = wfRandomString(); $mockWallClock = 1549343530.0; @@ -1499,7 +1499,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::getMulti() */ public function testGetMulti() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $value1 = [ 'this' => 'is', 'a' => 'test' ]; $value2 = [ 'this' => 'is', 'another' => 'test' ]; @@ -1565,7 +1565,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @dataProvider provideCoalesceAndMcrouterSettings */ public function testGetMultiCheckKeys( array $params ) { - list( $cache ) = $this->newWanCache( $params ); + [ $cache ] = $this->newWanCache( $params ); $checkAll = wfRandomString(); $check1 = wfRandomString(); @@ -1646,7 +1646,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::processCheckKeys() */ public function testCheckKeyInitHoldoff() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); for ( $i = 0; $i < 500; ++$i ) { $key = wfRandomString(); @@ -1679,7 +1679,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::processCheckKeys() */ public function testCheckKeyHoldoff() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $key = wfRandomString(); $checkKey = wfRandomString(); @@ -1710,7 +1710,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::makeTombstonePurgeValue */ public function testDelete() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $key = wfRandomString(); $value = wfRandomString(); $cache->set( $key, $value ); @@ -1754,7 +1754,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @param bool $versioned */ public function testGetWithSetCallback_versions( array $extOpts, $versioned ) { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $key = wfRandomString(); $valueV1 = wfRandomString(); @@ -1835,7 +1835,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @dataProvider provideCoalesceAndMcrouterSettings */ public function testInterimHoldOffCaching( array $params ) { - list( $cache, $bag ) = $this->newWanCache( $params ); + [ $cache, $bag ] = $this->newWanCache( $params ); $mockWallClock = 1549343530.0; $cache->setMockTime( $mockWallClock ); @@ -1903,7 +1903,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::parsePurgeValue */ public function testTouchKeys() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $key = wfRandomString(); $mockWallClock = 1549343530.0; @@ -1948,7 +1948,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @dataProvider provideCoalesceAndMcrouterSettings */ public function testGetWithSeveralCheckKeys( array $params ) { - list( $cache, $bag ) = $this->newWanCache( $params ); + [ $cache, $bag ] = $this->newWanCache( $params ); $key = wfRandomString(); $tKey1 = wfRandomString(); $tKey2 = wfRandomString(); @@ -1979,7 +1979,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { $this->hideDeprecated( 'WANObjectCache::reap' ); $this->hideDeprecated( 'WANObjectCache::reapCheckKey' ); - list( $cache, $bag ) = $this->newWanCache(); + [ $cache, $bag ] = $this->newWanCache(); $vKey1 = wfRandomString(); $vKey2 = wfRandomString(); $tKey1 = wfRandomString(); @@ -2065,7 +2065,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::set() */ public function testSetWithLag() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $mockWallClock = 1549343530.0; $cache->setMockTime( $mockWallClock ); @@ -2121,7 +2121,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::set() */ public function testWritePending() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $value = 1; $key = wfRandomString(); @@ -2255,7 +2255,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @param int $adaptiveTTL */ public function testAdaptiveTTL( $ago, $maxTTL, $minTTL, $factor, $adaptiveTTL ) { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $mtime = $ago ? time() - $ago : $ago; $margin = 5; $ttl = $cache->adaptiveTTL( $mtime, $maxTTL, $minTTL, $factor ); @@ -2294,7 +2294,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::setLogger */ public function testSetLogger() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $this->assertSame( null, $cache->setLogger( new Psr\Log\NullLogger ) ); } @@ -2376,7 +2376,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::makeMultiKeys */ public function testMakeMultiKeys() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $ids = [ 1, 2, 3, 4, 4, 5, 6, 6, 7, 7 ]; $keyCallback = static function ( $id, WANObjectCache $cache ) { @@ -2417,7 +2417,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::makeMultiKeys */ public function testMakeMultiKeysIntString() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $ids = [ 1, 2, 3, 4, '4', 5, 6, 6, 7, '7' ]; $keyCallback = static function ( $id, WANObjectCache $cache ) { return $cache->makeGlobalKey( 'key', $id, 'a', $id, 'b' ); @@ -2441,7 +2441,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::makeMultiKeys */ public function testMakeMultiKeysCollision() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $ids = [ 1, 2, 3, 4, '4', 5, 6, 6, 7 ]; $this->expectException( UnexpectedValueException::class ); @@ -2457,7 +2457,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::multiRemap */ public function testMultiRemap() { - list( $cache ) = $this->newWanCache(); + [ $cache ] = $this->newWanCache(); $ids = [ 'a', 'b', 'c' ]; $res = [ 'keyA' => 1, 'keyB' => 2, 'keyC' => 3 ]; @@ -2478,25 +2478,25 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @covers WANObjectCache::hash256 */ public function testHash256() { - list( $cache ) = $this->newWanCache( [ 'epoch' => 5 ] ); + [ $cache ] = $this->newWanCache( [ 'epoch' => 5 ] ); $this->assertEquals( 'f402bce76bfa1136adc705d8d5719911ce1fe61f0ad82ddf79a15f3c4de6ec4c', $cache->hash256( 'x' ) ); - list( $cache ) = $this->newWanCache( [ 'epoch' => 50 ] ); + [ $cache ] = $this->newWanCache( [ 'epoch' => 50 ] ); $this->assertSame( 'f79a126722f0a682c4c500509f1b61e836e56c4803f92edc89fc281da5caa54e', $cache->hash256( 'x' ) ); - list( $cache ) = $this->newWanCache( [ 'secret' => 'garden' ] ); + [ $cache ] = $this->newWanCache( [ 'secret' => 'garden' ] ); $this->assertSame( '48cd57016ffe29981a1114c45e5daef327d30fc6206cb73edc3cb94b4d8fe093', $cache->hash256( 'x' ) ); - list( $cache ) = $this->newWanCache( [ 'secret' => 'garden', 'epoch' => 3 ] ); + [ $cache ] = $this->newWanCache( [ 'secret' => 'garden', 'epoch' => 3 ] ); $this->assertSame( '48cd57016ffe29981a1114c45e5daef327d30fc6206cb73edc3cb94b4d8fe093', $cache->hash256( 'x' ) @@ -2513,7 +2513,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase { * @param string|null $keyNeedle */ public function testCoalesceKeys( array $params, $keyNeedle ) { - list( $cache, $bag ) = $this->newWanCache( $params ); + [ $cache, $bag ] = $this->newWanCache( $params ); $key = wfRandomString(); $callback = static function () { return 2020; diff --git a/tests/phpunit/unit/includes/objectcache/RESTBagOStuffTest.php b/tests/phpunit/unit/includes/objectcache/RESTBagOStuffTest.php index 59c9c1cc547..d9f98c6df10 100644 --- a/tests/phpunit/unit/includes/objectcache/RESTBagOStuffTest.php +++ b/tests/phpunit/unit/includes/objectcache/RESTBagOStuffTest.php @@ -43,7 +43,7 @@ class RESTBagOStuffTest extends \MediaWikiUnitTestCase { 'method' => 'GET', 'url' => 'http://test/rest/42xyz42', 'headers' => [] - // list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) + // [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] ] )->willReturn( [ 200, 'OK', [], $data, 0 ] ); $result = $this->bag->get( '42xyz42' ); $this->assertEquals( 'somedata', $result ); @@ -64,7 +64,7 @@ class RESTBagOStuffTest extends \MediaWikiUnitTestCase { 'method' => 'GET', 'url' => 'http://test/rest/42xyz42', 'headers' => [] - // list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) + // [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] ] )->willReturn( [ 404, 'Not found', [], 'Nothing to see here', 0 ] ); $result = $this->bag->get( '42xyz42' ); $this->assertFalse( $result ); @@ -75,7 +75,7 @@ class RESTBagOStuffTest extends \MediaWikiUnitTestCase { 'method' => 'GET', 'url' => 'http://test/rest/42xyz42', 'headers' => [] - // list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) + // [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] ] )->willReturn( [ 0, '', [], '', 'cURL has failed you today' ] ); $result = $this->bag->get( '42xyz42' ); $this->assertFalse( $result ); @@ -87,7 +87,7 @@ class RESTBagOStuffTest extends \MediaWikiUnitTestCase { 'method' => 'GET', 'url' => 'http://test/rest/42xyz42', 'headers' => [] - // list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) + // [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] ] )->willReturn( [ 500, 'Too busy', [], 'Server is too busy', '' ] ); $result = $this->bag->get( '42xyz42' ); $this->assertFalse( $result ); @@ -113,7 +113,7 @@ class RESTBagOStuffTest extends \MediaWikiUnitTestCase { 'url' => 'http://test/rest/42xyz42', 'body' => $data, 'headers' => [] - // list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) + // [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] ] )->willReturn( [ 200, 'OK', [], 'Done', 0 ] ); $result = $this->bag->set( '42xyz42', 'somedata' ); $this->assertTrue( $result ); @@ -134,7 +134,7 @@ class RESTBagOStuffTest extends \MediaWikiUnitTestCase { 'method' => 'DELETE', 'url' => 'http://test/rest/42xyz42', 'headers' => [] - // list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) + // [ $rcode, $rdesc, $rhdrs, $rbody, $rerr ] ] )->willReturn( [ 200, 'OK', [], 'Done', 0 ] ); $result = $this->bag->delete( '42xyz42' ); $this->assertTrue( $result ); diff --git a/tests/phpunit/unit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php b/tests/phpunit/unit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php index 1a16b902c65..9045f7f8788 100644 --- a/tests/phpunit/unit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php +++ b/tests/phpunit/unit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php @@ -232,7 +232,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiUnitTestCase { $this->assertIsArray( $items ); $this->assertCount( 2, $items ); - foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) { + foreach ( $items as [ $watchedItem, $recentChangeInfo ] ) { $this->assertInstanceOf( WatchedItem::class, $watchedItem ); $this->assertIsArray( $recentChangeInfo ); } @@ -391,7 +391,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiUnitTestCase { $this->assertIsArray( $items ); $this->assertCount( 2, $items ); - foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) { + foreach ( $items as [ $watchedItem, $recentChangeInfo ] ) { $this->assertInstanceOf( WatchedItem::class, $watchedItem ); $this->assertIsArray( $recentChangeInfo ); } diff --git a/tests/phpunit/unit/includes/watchlist/WatchlistManagerTest.php b/tests/phpunit/unit/includes/watchlist/WatchlistManagerTest.php index dc7c92a2d6a..365df15c2aa 100644 --- a/tests/phpunit/unit/includes/watchlist/WatchlistManagerTest.php +++ b/tests/phpunit/unit/includes/watchlist/WatchlistManagerTest.php @@ -113,7 +113,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { // Early return: read only mode $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, ) = $this->getAuthorityAndUserFactory( $userIdentity ); + [ $authority, ] = $this->getAuthorityAndUserFactory( $userIdentity ); $watchedItemStore = $this->createMock( WatchedItemStoreInterface::class ); $watchedItemStore->expects( $this->never() ) @@ -133,7 +133,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { // Early return: User lacks `editmywatchlist` $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( $userIdentity ); + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity ); $watchedItemStore = $this->createMock( WatchedItemStoreInterface::class ); $watchedItemStore->expects( $this->never() ) @@ -153,7 +153,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { // Early return: config with `EnotifUserTalk`, `EnotifWatchlist` and `ShowUpdatedMarker` are false $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -187,7 +187,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { ]; $userIdentity = new UserIdentityValue( 0, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -217,7 +217,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { ]; $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -261,7 +261,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { $title = $testPageFactory( 100, 0, 'SomeDbKey' ); $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, ) = $this->getAuthorityAndUserFactory( $userIdentity ); + [ $authority, ] = $this->getAuthorityAndUserFactory( $userIdentity ); $watchedItemStore = $this->createMock( WatchedItemStoreInterface::class ); $watchedItemStore->expects( $this->never() ) @@ -286,7 +286,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { $title = $testPageFactory( 100, 0, 'SomeDbKey' ); $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( $userIdentity ); + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity ); $watchedItemStore = $this->createMock( WatchedItemStoreInterface::class ); $watchedItemStore->expects( $this->never() ) @@ -311,7 +311,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { $title = $testPageFactory( 100, NS_USER_TALK, 'PageTitleGoesHere' ); $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -345,7 +345,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { ]; $userIdentity = new UserIdentityValue( 0, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -380,7 +380,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { ]; $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -557,7 +557,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { public function testSetWatchWithExpiry() { // Already watched, but we're adding an expiry so 'addWatch' should be called. $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -609,7 +609,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { */ public function testSetWatchSkipsIfAlreadyWatched() { $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -639,7 +639,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { */ public function testSetWatchSkipsIfAlreadyUnWatched() { $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -665,7 +665,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { */ public function testSetWatchWatchesIfWatch() { $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -691,7 +691,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { */ public function testSetWatchUnwatchesIfUnwatch() { $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -715,7 +715,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { */ public function testAddWatchNoCheckRights() { $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [] ); @@ -739,7 +739,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { */ public function testAddWatchSuccess() { $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -763,7 +763,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { */ public function testRemoveWatchUserHookAborted() { $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); @@ -798,7 +798,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase { */ public function testRemoveWatchSuccess() { $userIdentity = new UserIdentityValue( 100, 'User Name' ); - list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory( + [ $authority, $userFactory ] = $this->getAuthorityAndUserFactory( $userIdentity, [ 'editmywatchlist' ] ); diff --git a/thumb.php b/thumb.php index 99c9f64b015..19d72e48ab9 100644 --- a/thumb.php +++ b/thumb.php @@ -363,7 +363,7 @@ function wfStreamThumb( array $params ) { return; } else { // Generate the thumbnail locally - list( $thumb, $errorMsg ) = wfGenerateThumbnail( $img, $params, $thumbName, $thumbPath ); + [ $thumb, $errorMsg ] = wfGenerateThumbnail( $img, $params, $thumbName, $thumbPath ); } /** @var MediaTransformOutput|MediaTransformError|bool $thumb */ @@ -561,10 +561,10 @@ function wfExtractThumbRequestInfo( $thumbRel ) { // Check if this is a thumbnail of an original in the local file repo if ( preg_match( "!^((archive/)?$hashDirReg([^/]*)/([^/]*))$!", $thumbRel, $m ) ) { - list( /*all*/, $rel, $archOrTemp, $filename, $thumbname ) = $m; + [ /*all*/, $rel, $archOrTemp, $filename, $thumbname ] = $m; // Check if this is a thumbnail of an temp file in the local file repo } elseif ( preg_match( "!^(temp/)($hashDirReg([^/]*)/([^/]*))$!", $thumbRel, $m ) ) { - list( /*all*/, $archOrTemp, $rel, $filename, $thumbname ) = $m; + [ /*all*/, $archOrTemp, $rel, $filename, $thumbname ] = $m; } else { return null; // not a valid looking thumbnail request }