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

This commit is contained in:
jenkins-bot 2022-11-09 13:04:45 +00:00 committed by Gerrit Code Review
commit ef5f45d3bd
7 changed files with 13 additions and 13 deletions

View file

@ -931,7 +931,7 @@ abstract class EchoDiscussionParser {
return true;
}
list( , $foundUser ) = $userData;
[ , $foundUser ] = $userData;
$userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils();
return $userNameUtils->getCanonical( $foundUser, UserNameUtils::RIGOR_NONE ) ===
@ -1008,7 +1008,7 @@ abstract class EchoDiscussionParser {
continue;
}
list( $signaturePos, $user ) = $userData;
[ $signaturePos, $user ] = $userData;
$signature = substr( $line, $signaturePos );
$output[$user] = $signature;

View file

@ -191,9 +191,9 @@ class EchoDiffParser {
$change = null;
}
// @@ -start,numLines +start,numLines @@
list( , $left, $right ) = explode( ' ', $line, 3 );
list( $this->leftPos ) = explode( ',', substr( $left, 1 ), 2 );
list( $this->rightPos ) = explode( ',', substr( $right, 1 ), 2 );
[ , $left, $right ] = explode( ' ', $line, 3 );
[ $this->leftPos ] = explode( ',', substr( $left, 1 ), 2 );
[ $this->rightPos ] = explode( ',', substr( $right, 1 ), 2 );
$this->leftPos = (int)$this->leftPos;
$this->rightPos = (int)$this->rightPos;

View file

@ -205,7 +205,7 @@ class EchoForeignNotifications {
$data = [];
foreach ( $wikis as $wiki ) {
$siteFromDB = $wgConf->siteFromDB( $wiki );
list( $major, $minor ) = $siteFromDB;
[ $major, $minor ] = $siteFromDB;
$server = $wgConf->get( 'wgServer', $wiki, $major, [ 'lang' => $minor, 'site' => $major ] );
$scriptPath = $wgConf->get( 'wgScriptPath', $wiki, $major, [ 'lang' => $minor, 'site' => $major ] );
$articlePath = $wgConf->get( 'wgArticlePath', $wiki, $major, [ 'lang' => $minor, 'site' => $major ] );
@ -238,7 +238,7 @@ class EchoForeignNotifications {
if ( $siteFromDB === null ) {
$siteFromDB = $wgConf->siteFromDB( $wikiId );
}
list( $site, $langCode ) = $siteFromDB;
[ $site, $langCode ] = $siteFromDB;
// try to fetch site name for this specific wiki, or fallback to the
// general project's sitename if there is no override

View file

@ -297,7 +297,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable, MessageLo
* the user is visible or not.
* @par Example:
* @code
* list( $formattedName, $genderName ) = $this->getAgentForOutput();
* [ $formattedName, $genderName ] = $this->getAgentForOutput();
* $msg->params( $formattedName, $genderName );
* @endcode
*/
@ -330,7 +330,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable, MessageLo
*/
final protected function getMessageWithAgent( $key ) {
$msg = $this->msg( $key );
list( $formattedName, $genderName ) = $this->getAgentForOutput();
[ $formattedName, $genderName ] = $this->getAgentForOutput();
$msg->params( $formattedName, $genderName );
return $msg;
}

View file

@ -17,7 +17,7 @@ class EchoUserRightsPresentationModel extends EchoEventPresentationModel {
}
public function getHeaderMessage() {
list( $formattedName, $genderName ) = $this->getAgentForOutput();
[ $formattedName, $genderName ] = $this->getAgentForOutput();
$add = array_map(
[ $this->language, 'embedBidi' ],
$this->getLocalizedGroupNames( array_values( $this->event->getExtraParam( 'add', [] ) ) )

View file

@ -42,7 +42,7 @@ class RemoveOrphanedEvents extends LoggedUpdateMaintenance {
$targetsProcessedTotal = 0;
while ( $startId < $maxId ) {
$startId += $this->getBatchSize() * 1000;
list( $eventsProcessed, $targetsProcessed ) = $this->doMajorBatch( $startId );
[ $eventsProcessed, $targetsProcessed ] = $this->doMajorBatch( $startId );
$eventsProcessedTotal += $eventsProcessed;
$targetsProcessedTotal += $targetsProcessed;
}

View file

@ -71,7 +71,7 @@ class EchoUserLocatorTest extends MediaWikiIntegrationTestCase {
*/
public function testLocateTalkPageOwner( $message, $expect, Title $title = null ) {
if ( $expect instanceof Closure ) {
list( $expect, $title ) = $expect();
[ $expect, $title ] = $expect();
}
$event = $this->createMock( EchoEvent::class );
$event->method( 'getTitle' )
@ -103,7 +103,7 @@ class EchoUserLocatorTest extends MediaWikiIntegrationTestCase {
* @dataProvider locateArticleCreatorProvider
*/
public function testLocateArticleCreator( $message, $initialize ) {
list( $expect, $title, $user ) = $initialize();
[ $expect, $title, $user ] = $initialize();
$this->getServiceContainer()->getWikiPageFactory()->newFromTitle( $title )->doUserEditContent(
/* $content = */ ContentHandler::makeContent( 'content', $title ),
/* $user = */ $user,