Nikerabbit has uploaded a new change for review. https://gerrit.wikimedia.org/r/271227
Change subject: Update mediawiki-codesniffer ...................................................................... Update mediawiki-codesniffer Change-Id: I6724f155a1158658a09973f41cdfaf09d014d1ba --- M CleanChanges_body.php M Filters.php M composer.json 3 files changed, 59 insertions(+), 57 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CleanChanges refs/changes/27/271227/1 diff --git a/CleanChanges_body.php b/CleanChanges_body.php index 311eb73..3f66370 100644 --- a/CleanChanges_body.php +++ b/CleanChanges_body.php @@ -38,7 +38,7 @@ return $list === null; } - protected static $userinfo = array(); + protected static $userinfo = []; /** * @param $vars array @@ -79,7 +79,7 @@ return Xml::openElement( 'div', - array( 'style' => "direction: $dir" ) + [ 'style' => "direction: $dir" ] ); } @@ -144,8 +144,8 @@ $clink = linker::linkKnown( $titleObj, null, - array(), - array( 'rcid' => $rc_id ) + [], + [ 'rcid' => $rc_id ] ); } else { $clink = Linker::linkKnown( $titleObj ); @@ -156,8 +156,8 @@ $rc->timestamp = $time; $rc->numberofWatchingusers = $baseRC->numberofWatchingusers; - $rc->_reqCurId = array( 'curid' => $rc->getAttribute( 'rc_cur_id' ) ); - $rc->_reqOldId = array( 'oldid' => $rc->getAttribute( 'rc_this_oldid' ) ); + $rc->_reqCurId = [ 'curid' => $rc->getAttribute( 'rc_cur_id' ) ]; + $rc->_reqOldId = [ 'oldid' => $rc->getAttribute( 'rc_this_oldid' ) ]; $this->makeLinks( $rc ); // Make user links @@ -166,7 +166,7 @@ $this->msg( 'rev-deleted-user' )->escaped() . '</span>'; $rc->_userInfo = ''; - self::$userinfo += array(); + self::$userinfo += []; } else { $rc->_user = Linker::userLink( $rc->getAttribute( 'rc_user' ), @@ -192,7 +192,7 @@ if ( $date !== $this->lastdate ) { # Process current cache $ret = $this->recentChangesBlock(); - $this->rc_cache = array(); + $this->rc_cache = []; $ret .= Xml::element( 'h4', null, $date ) . "\n"; $this->lastdate = $date; } @@ -221,30 +221,30 @@ if ( !$this->isLog( $rc ) ) { # Make cur, diff and last links - $querycur = array( 'diff' => 0 ) + $rc->_reqCurId + $rc->_reqOldId; - $querydiff = array( + $querycur = [ 'diff' => 0 ] + $rc->_reqCurId + $rc->_reqOldId; + $querydiff = [ 'diff' => $rc->getAttribute( 'rc_this_oldid' ), 'oldid' => $rc->getAttribute( 'rc_last_oldid' ), 'rcid' => $rc->unpatrolled ? $rc->getAttribute( 'rc_id' ) : '', - ) + $rc->_reqCurId; + ] + $rc->_reqCurId; $rc->_curLink = Linker::linkKnown( $rc->getTitle(), - $this->message['cur'], array(), $querycur ); + $this->message['cur'], [], $querycur ); if ( $rc->getAttribute( 'rc_type' ) != RC_NEW ) { $rc->_diffLink = Linker::linkKnown( $rc->getTitle(), - $this->message['diff'], array(), $querydiff ); + $this->message['diff'], [], $querydiff ); } if ( $rc->getAttribute( 'rc_last_oldid' ) != 0 ) { // This is not the first revision $rc->_lastLink = Linker::linkKnown( $rc->getTitle(), - $this->message['last'], array(), $querydiff ); + $this->message['last'], [], $querydiff ); } $rc->_histLink = Linker::link( $rc->getTitle(), - $this->message['hist'], array(), - $rc->_reqCurId + array( 'action' => 'history' ) + $this->message['hist'], [], + $rc->_reqCurId + [ 'action' => 'history' ] ); } } @@ -257,8 +257,8 @@ protected function recentChangesBlockGroup( $block ) { # Collate list of users $isnew = false; - $userlinks = array(); - $overrides = array( 'minor' => false, 'bot' => false ); + $userlinks = []; + $overrides = [ 'minor' => false, 'bot' => false ]; $oldid = 0; foreach ( $block as $rcObj ) { $oldid = $rcObj->mAttribs['rc_last_oldid']; @@ -285,11 +285,11 @@ $rcm = 'RCM' . $this->rcCacheIndex; $toggleLink = "javascript:toggleVisibilityE('$rci', '$rcm', '$rcl', 'block')"; $tl = - Xml::tags( 'span', array( 'id' => $rcm ), - Xml::tags( 'a', array( 'href' => $toggleLink ), + Xml::tags( 'span', [ 'id' => $rcm ], + Xml::tags( 'a', [ 'href' => $toggleLink ], $this->arrow( $this->direction ? 'r' : 'l' ) ) ) . - Xml::tags( 'span', array( 'id' => $rcl, 'style' => 'display: none;' ), - Xml::tags( 'a', array( 'href' => $toggleLink ), $this->downArrow() ) ); + Xml::tags( 'span', [ 'id' => $rcl, 'style' => 'display: none;' ], + Xml::tags( 'a', [ 'href' => $toggleLink ], $this->downArrow() ) ); $items[] = $tl . $info; @@ -300,7 +300,7 @@ if ( !$log ) { # Changes $n = count( $block ); - static $nchanges = array(); + static $nchanges = []; if ( !isset( $nchanges[$n] ) ) { $nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n )->escaped(); } @@ -309,12 +309,12 @@ $changes = Linker::linkKnown( $block[0]->getTitle(), $nchanges[$n], - array(), - array( + [], + [ 'curid' => $block[0]->mAttribs['rc_cur_id'], 'diff' => $block[0]->mAttribs['rc_this_oldid'], 'oldid' => $oldid - ) + ] ); } else { $changes = $nchanges[$n]; @@ -334,7 +334,7 @@ # Sub-entries $lines .= Xml::tags( 'div', - array( 'id' => $rci, 'style' => 'display: none;' ), + [ 'id' => $rci, 'style' => 'display: none;' ], $this->subEntries( $block ) ) . "\n"; @@ -354,13 +354,13 @@ return Html::element( 'img', - array( + [ 'src' => "$wgExtensionAssetsPath/CleanChanges/images/Arr_$dir.png", 'width' => 12, 'height' => 12, 'alt' => $alt, 'title' => $title, - ) + ] ); } @@ -399,7 +399,7 @@ protected function subEntries( array $block ) { $lines = ''; foreach ( $block as $rcObj ) { - $items = array(); + $items = []; $log = $this->isLog( $rcObj ); $time = $rcObj->timestamp; @@ -407,7 +407,7 @@ $time = Linker::linkKnown( $rcObj->getTitle(), $rcObj->timestamp, - array(), + [], $rcObj->_reqOldId + $rcObj->_reqCurId ); } @@ -538,7 +538,7 @@ static $linkindex = 0; $linkindex++; - static $users = array(); + static $users = []; $userindex = array_search( $userText, $users, true ); if ( $userindex === false ) { $users[] = $userText; @@ -546,24 +546,24 @@ } global $wgExtensionAssetsPath; - $image = Xml::element( 'img', array( + $image = Xml::element( 'img', [ 'src' => $wgExtensionAssetsPath . '/CleanChanges/images/showuserlinks.png', 'alt' => $this->msg( 'cleanchanges-showuserlinks' )->text(), 'title' => $this->msg( 'cleanchanges-showuserlinks' )->text(), 'width' => '15', 'height' => '11', - ) + ] ); $rci = 'RCUI' . $userindex; $rcl = 'RCUL' . $linkindex; $rcm = 'RCUM' . $linkindex; $toggleLink = "javascript:showUserInfo('wgUserInfo$rci', '$rcl' )"; - $tl = Xml::tags( 'span', array( 'id' => $rcm ), - Xml::tags( 'a', array( 'href' => $toggleLink ), $image ) ); - $tl .= Xml::element( 'span', array( 'id' => $rcl ), ' ' ); + $tl = Xml::tags( 'span', [ 'id' => $rcm ], + Xml::tags( 'a', [ 'href' => $toggleLink ], $image ) ); + $tl .= Xml::element( 'span', [ 'id' => $rcl ], ' ' ); - $items = array(); + $items = []; if ( $talkable ) { $items[] = Linker::userTalkLink( $userId, $userText ); } @@ -588,9 +588,9 @@ $msg = $this->msg( 'parentheses' ) ->rawParams( $this->getLanguage()->pipeList( $items ) ) ->escaped(); - $data = array( "wgUserInfo$rci" => $msg ); + $data = [ "wgUserInfo$rci" => $msg ]; - return array( $tl, $data ); + return [ $tl, $data ]; } else { return ''; } @@ -608,7 +608,7 @@ krsort( $userlinks ); asort( $userlinks ); - $users = array(); + $users = []; foreach ( $userlinks as $userlink => $count ) { $text = $userlink; if ( $count > 1 ) { @@ -629,16 +629,16 @@ */ protected function getFlags( $rc, array $overrides = null ) { // @todo We assume all characters are of equal width, which they may be not - $map = array( + $map = [ # item => field letter-or-something - 'new' => array( 'rc_new', self::flag( 'newpage' ) ), - 'minor' => array( 'rc_minor', self::flag( 'minor' ) ), - 'bot' => array( 'rc_bot', self::flag( 'bot' ) ), - ); + 'new' => [ 'rc_new', self::flag( 'newpage' ) ], + 'minor' => [ 'rc_minor', self::flag( 'minor' ) ], + 'bot' => [ 'rc_bot', self::flag( 'bot' ) ], + ]; static $nothing = "\xc2\xa0"; - $items = array(); + $items = []; foreach ( $map as $item => $data ) { list( $field, $flag ) = $data; $bool = isset( $overrides[$item] ) ? $overrides[$item] : $rc->getAttribute( $field ); @@ -684,7 +684,7 @@ */ public function wrapCharacterDifference( $szdiff ) { global $wgRCChangedSizeThreshold; - static $cache = array(); + static $cache = []; if ( !isset( $cache[$szdiff] ) ) { // @todo FIXME: Hard coded text (+). $prefix = $szdiff > 0 ? '+' : ''; @@ -715,8 +715,8 @@ */ protected function XMLwrapper( $class, $content, $tag = 'span', $escape = true ) { if ( $escape ) { - return Xml::element( $tag, array( 'class' => $class ), $content ); + return Xml::element( $tag, [ 'class' => $class ], $content ); } - return Xml::tags( $tag, array( 'class' => $class ), $content ); + return Xml::tags( $tag, [ 'class' => $class ], $content ); } } diff --git a/Filters.php b/Filters.php index 18d8ae8..057a78d 100644 --- a/Filters.php +++ b/Filters.php @@ -26,7 +26,7 @@ return; } - $idfilters = array(); + $idfilters = []; $userArr = explode( '|', $users ); foreach ( $userArr as $u ) { $id = User::idFromName( $u ); @@ -109,7 +109,7 @@ $default = $wgRequest->getVal( 'trailer', '' ); - if ( is_callable( array( 'LanguageNames', 'getNames' ) ) ) { + if ( is_callable( [ 'LanguageNames', 'getNames' ] ) ) { $languages = LanguageNames::getNames( $wgLang->getCode(), LanguageNames::FALLBACK_NORMAL, LanguageNames::LIST_MW @@ -124,14 +124,14 @@ $options .= Xml::option( "$code - $name", "/$code", $selected ) . "\n"; } $str = - Xml::openElement( 'select', array( + Xml::openElement( 'select', [ 'name' => 'trailer', 'class' => 'mw-language-selector', 'id' => 'sp-rc-language', - ) ) . + ] ) . $options . Xml::closeElement( 'select' ); - $items['tailer'] = array( wfMessage( 'cleanchanges-language' )->escaped(), $str ); + $items['tailer'] = [ wfMessage( 'cleanchanges-language' )->escaped(), $str ]; } } diff --git a/composer.json b/composer.json index da3b947..9136cfe 100644 --- a/composer.json +++ b/composer.json @@ -5,13 +5,15 @@ "homepage": "https://www.mediawiki.org/wiki/Extension:CleanChanges", "license": "GPL-2.0+", "require": { - "composer/installers": "*" + "php": ">=5.5.9", + "composer/installers": ">=1.0.1" }, "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "mediawiki/mediawiki-codesniffer": "0.5.1" + "mediawiki/mediawiki-codesniffer": "0.6.0" }, "scripts": { + "fix": "phpcbf", "test": [ "parallel-lint . --exclude vendor", "phpcs -p -s" -- To view, visit https://gerrit.wikimedia.org/r/271227 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6724f155a1158658a09973f41cdfaf09d014d1ba Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CleanChanges Gerrit-Branch: master Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits