update mediawiki-codesniffer to 0.11.0 and fix issues
authorWMDE-Fisch <christoph.jauera@wikimedia.de>
Fri, 11 Aug 2017 13:53:17 +0000 (15:53 +0200)
committerWMDE-Fisch <christoph.jauera@wikimedia.de>
Fri, 11 Aug 2017 20:27:51 +0000 (22:27 +0200)
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case  passing by reference

Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c

47 files changed:
composer.json
includes/Block.php
includes/DefaultSettings.php
includes/EditPage.php
includes/MovePage.php
includes/RevisionList.php
includes/Sanitizer.php
includes/api/ApiCSPReport.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryWatchlist.php
includes/api/SearchApi.php
includes/changes/ChangesListFilterGroup.php
includes/changes/OldChangesList.php
includes/filebackend/filejournal/DBFileJournal.php
includes/installer/Installer.php
includes/libs/composer/ComposerInstalled.php
includes/libs/composer/ComposerLock.php
includes/parser/Parser.php
includes/parser/ParserOptions.php
includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php
includes/profiler/SectionProfiler.php
includes/search/SearchEngine.php
includes/search/SearchSqlite.php
includes/site/Site.php
includes/specialpage/LoginSignupSpecialPage.php
includes/specials/SpecialExport.php
includes/specials/SpecialMediaStatistics.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialWatchlist.php
includes/specials/helpers/LoginHelper.php
includes/specials/pagers/UsersPager.php
includes/tidy/Balancer.php
includes/widget/search/InterwikiSearchResultSetWidget.php
includes/widget/search/InterwikiSearchResultWidget.php
languages/Language.php
languages/classes/LanguageKk.php
languages/classes/LanguageSr.php
languages/messages/MessagesKm.php
maintenance/hhvm/makeRepo.php
maintenance/refreshLinks.php
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/changes/ChangesListFilterTest.php
tests/phpunit/includes/config/EtcdConfigTest.php
tests/phpunit/includes/interwiki/ClassicInterwikiLookupTest.php
tests/phpunit/mocks/media/MockOggHandler.php
tests/qunit/data/load.mock.php

index bc48360..32933e6 100644 (file)
@@ -53,7 +53,7 @@
                "jakub-onderka/php-parallel-lint": "0.9.2",
                "jetbrains/phpstorm-stubs": "dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a",
                "justinrainbow/json-schema": "~5.2",
-               "mediawiki/mediawiki-codesniffer": "0.10.1",
+               "mediawiki/mediawiki-codesniffer": "0.11.0",
                "monolog/monolog": "~1.22.1",
                "nikic/php-parser": "2.1.0",
                "nmred/kafka-php": "0.1.5",
index 8fc2686..843ea54 100644 (file)
@@ -1501,7 +1501,7 @@ class Block {
                        return $id;
                }
                $hmac = MWCryptHash::hmac( $id, $secretKey, false );
-               $cookieValue =  $id . '!' . $hmac;
+               $cookieValue = $id . '!' . $hmac;
                return $cookieValue;
        }
 
index a28aa5b..ba755fa 100644 (file)
@@ -5797,7 +5797,7 @@ $wgPasswordAttemptThrottle = [
        // Long term limit. We need to balance the risk
        // of somebody using this as a DoS attack to lock someone
        // out of their account, and someone doing a brute force attack.
-       [ 'count' => 150, 'seconds' => 60*60*48 ],
+       [ 'count' => 150, 'seconds' => 60 * 60 * 48 ],
 ];
 
 /**
index cc27e88..49341c5 100644 (file)
@@ -4333,7 +4333,7 @@ class EditPage {
                $newPage = !$this->mTitle->exists();
 
                if ( $labelAsPublish ) {
-                       $buttonLabelKey =  $newPage ? 'publishpage' : 'publishchanges';
+                       $buttonLabelKey = $newPage ? 'publishpage' : 'publishchanges';
                } else {
                        $buttonLabelKey = $newPage ? 'savearticle' : 'savechanges';
                }
index 8d0c33d..39dc642 100644 (file)
@@ -511,7 +511,7 @@ class MovePage {
                $logEntry->setComment( $reason );
                $logEntry->setParameters( [
                        '4::target' => $nt->getPrefixedText(),
-                       '5::noredir' => $redirectContent ? '0': '1',
+                       '5::noredir' => $redirectContent ? '0' : '1',
                ] );
 
                $formatter = LogFormatter::newFromEntry( $logEntry );
index ccdedb8..b0bc60a 100644 (file)
@@ -116,7 +116,7 @@ abstract class RevisionListBase extends ContextSource implements Iterator {
        }
 
        public function key() {
-               return $this->res ? $this->res->key(): 0;
+               return $this->res ? $this->res->key() : 0;
        }
 
        public function valid() {
index b6b7922..ed09701 100644 (file)
@@ -1677,7 +1677,10 @@ class Sanitizer {
                $text = preg_replace_callback(
                        self::CHAR_REFS_REGEX,
                        [ 'Sanitizer', 'decodeCharReferencesCallback' ],
-                       $text, /* limit */ -1, $count );
+                       $text,
+                       -1, //limit
+                       $count
+               );
 
                if ( $count ) {
                        return $wgContLang->normalize( $text );
index 3a78c13..9ad24c1 100644 (file)
@@ -115,7 +115,7 @@ class ApiCSPReport extends ApiBase {
                $req = $this->getRequest();
                $contentType = $req->getHeader( 'content-type' );
                if ( $contentType !== 'application/json'
-                       && $contentType !=='application/csp-report'
+                       && $contentType !== 'application/csp-report'
                ) {
                        $this->error( 'wrongformat', __METHOD__ );
                }
index bfd5b17..7b0080e 100644 (file)
@@ -767,30 +767,30 @@ class ApiQueryImageInfo extends ApiQueryBase {
         */
        private static function getProperties( $modulePrefix = '' ) {
                return [
-                       'timestamp' =>      ' timestamp     - Adds timestamp for the uploaded version',
-                       'user' =>           ' user          - Adds the user who uploaded the image version',
-                       'userid' =>         ' userid        - Add the user ID that uploaded the image version',
-                       'comment' =>        ' comment       - Comment on the version',
-                       'parsedcomment' =>  ' parsedcomment - Parse the comment on the version',
+                       'timestamp' => ' timestamp     - Adds timestamp for the uploaded version',
+                       'user' => ' user          - Adds the user who uploaded the image version',
+                       'userid' => ' userid        - Add the user ID that uploaded the image version',
+                       'comment' => ' comment       - Comment on the version',
+                       'parsedcomment' => ' parsedcomment - Parse the comment on the version',
                        'canonicaltitle' => ' canonicaltitle - Adds the canonical title of the image file',
-                       'url' =>            ' url           - Gives URL to the image and the description page',
-                       'size' =>           ' size          - Adds the size of the image in bytes, ' .
+                       'url' => ' url           - Gives URL to the image and the description page',
+                       'size' => ' size          - Adds the size of the image in bytes, ' .
                                'its height and its width. Page count and duration are added if applicable',
-                       'dimensions' =>     ' dimensions    - Alias for size', // B/C with Allimages
-                       'sha1' =>           ' sha1          - Adds SHA-1 hash for the image',
-                       'mime' =>           ' mime          - Adds MIME type of the image',
-                       'thumbmime' =>      ' thumbmime     - Adds MIME type of the image thumbnail' .
+                       'dimensions' => ' dimensions    - Alias for size', // B/C with Allimages
+                       'sha1' => ' sha1          - Adds SHA-1 hash for the image',
+                       'mime' => ' mime          - Adds MIME type of the image',
+                       'thumbmime' => ' thumbmime     - Adds MIME type of the image thumbnail' .
                                ' (requires url and param ' . $modulePrefix . 'urlwidth)',
-                       'mediatype' =>      ' mediatype     - Adds the media type of the image',
-                       'metadata' =>       ' metadata      - Lists Exif metadata for the version of the image',
+                       'mediatype' => ' mediatype     - Adds the media type of the image',
+                       'metadata' => ' metadata      - Lists Exif metadata for the version of the image',
                        'commonmetadata' => ' commonmetadata - Lists file format generic metadata ' .
                                'for the version of the image',
-                       'extmetadata' =>    ' extmetadata   - Lists formatted metadata combined ' .
+                       'extmetadata' => ' extmetadata   - Lists formatted metadata combined ' .
                                'from multiple sources. Results are HTML formatted.',
-                       'archivename' =>    ' archivename   - Adds the file name of the archive ' .
+                       'archivename' => ' archivename   - Adds the file name of the archive ' .
                                'version for non-latest versions',
-                       'bitdepth' =>       ' bitdepth      - Adds the bit depth of the version',
-                       'uploadwarning' =>  ' uploadwarning - Used by the Special:Upload page to ' .
+                       'bitdepth' => ' bitdepth      - Adds the bit depth of the version',
+                       'uploadwarning' => ' uploadwarning - Used by the Special:Upload page to ' .
                                'get information about an existing file. Not intended for use outside MediaWiki core',
                ];
        }
index f8f6e7d..9883480 100644 (file)
@@ -179,7 +179,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                $watchedItemQuery = MediaWikiServices::getInstance()->getWatchedItemQueryService();
                $items = $watchedItemQuery->getWatchedItemsWithRecentChangeInfo( $wlowner, $options, $startFrom );
 
-               foreach ( $items as list ( $watchedItem, $recentChangeInfo ) ) {
+               foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
                        /** @var WatchedItem $watchedItem */
                        if ( is_null( $resultPageSet ) ) {
                                $vals = $this->extractOutputData( $watchedItem, $recentChangeInfo );
index 552292b..f7c6471 100644 (file)
@@ -115,7 +115,7 @@ trait SearchApi {
                        $defaultProfile = null;
                        foreach ( $profiles as $profile ) {
                                $types[] = $profile['name'];
-                               if ( isset ( $profile['desc-message'] ) ) {
+                               if ( isset( $profile['desc-message'] ) ) {
                                        $helpMessages[$profile['name']] = $profile['desc-message'];
                                }
                                if ( !empty( $profile['default'] ) ) {
index 0dc1145..5762752 100644 (file)
@@ -165,7 +165,7 @@ abstract class ChangesListFilterGroup {
                        $this->title = $groupDefinition['title'];
                }
 
-               if ( isset ( $groupDefinition['whatsThisHeader'] ) ) {
+               if ( isset( $groupDefinition['whatsThisHeader'] ) ) {
                        $this->whatsThisHeader = $groupDefinition['whatsThisHeader'];
                        $this->whatsThisBody = $groupDefinition['whatsThisBody'];
                        $this->whatsThisUrl = $groupDefinition['whatsThisUrl'];
@@ -352,7 +352,7 @@ abstract class ChangesListFilterGroup {
                        'messageKeys' => [ $this->title ]
                ];
 
-               if ( isset ( $this->whatsThisHeader ) ) {
+               if ( isset( $this->whatsThisHeader ) ) {
                        $output['whatsThisHeader'] = $this->whatsThisHeader;
                        $output['whatsThisBody'] = $this->whatsThisBody;
                        $output['whatsThisUrl'] = $this->whatsThisUrl;
index 4c4fb7e..4d6187b 100644 (file)
@@ -82,7 +82,7 @@ class OldChangesList extends ChangesList {
                if ( $rc->mAttribs['rc_log_type'] ) {
                        $logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
                        $this->insertLog( $html, $logtitle, $rc->mAttribs['rc_log_type'] );
-                       $flags = $this->recentChangesFlags( [ 'unpatrolled' =>$unpatrolled,
+                       $flags = $this->recentChangesFlags( [ 'unpatrolled' => $unpatrolled,
                                'bot' => $rc->mAttribs['rc_bot'] ], '' );
                        if ( $flags !== '' ) {
                                $html .= ' ' . $flags;
index 42b36ff..4269f91 100644 (file)
@@ -183,7 +183,7 @@ class DBFileJournal extends FileJournal {
        protected function getMasterDB() {
                if ( !$this->dbw ) {
                        // Get a separate connection in autocommit mode
-                       $lb =  MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->newMainLB();
+                       $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->newMainLB();
                        $this->dbw = $lb->getConnection( DB_MASTER, [], $this->wiki );
                        $this->dbw->clearFlag( DBO_TRX );
                }
index a29d987..46aa518 100644 (file)
@@ -1353,7 +1353,7 @@ abstract class Installer {
                }
 
                // extensions -> extension.json, skins -> skin.json
-               $jsonFile = substr( $directory, 0, strlen( $directory ) -1 ) . '.json';
+               $jsonFile = substr( $directory, 0, strlen( $directory ) - 1 ) . '.json';
 
                $dh = opendir( $extDir );
                $exts = [];
index 9f15078..ef2b768 100644 (file)
@@ -28,7 +28,7 @@ class ComposerInstalled {
                                'type' => $installed['type'],
                                'licenses' => isset( $installed['license'] ) ? $installed['license'] : [],
                                'authors' => isset( $installed['authors'] ) ? $installed['authors'] : [],
-                               'description' => isset( $installed['description'] ) ? $installed['description']: '',
+                               'description' => isset( $installed['description'] ) ? $installed['description'] : '',
                        ];
                }
 
index 818ccdf..dc8bc03 100644 (file)
@@ -28,7 +28,7 @@ class ComposerLock {
                                'type' => $installed['type'],
                                'licenses' => isset( $installed['license'] ) ? $installed['license'] : [],
                                'authors' => isset( $installed['authors'] ) ? $installed['authors'] : [],
-                               'description' => isset( $installed['description'] ) ? $installed['description']: '',
+                               'description' => isset( $installed['description'] ) ? $installed['description'] : '',
                        ];
                }
 
index 74ffc88..3261002 100644 (file)
@@ -3411,7 +3411,7 @@ class Parser {
                # string or an array containing the string and any flags. This mungs
                # things around to match what this method should return.
                if ( !is_array( $result ) ) {
-                       $result =[
+                       $result = [
                                'found' => true,
                                'text' => $result,
                        ];
index 5e2845f..c7146a1 100644 (file)
@@ -1062,11 +1062,13 @@ class ParserOptions {
                                'speculativeRevIdCallback' => null,
                        ];
 
+                       // @codingStandardsIgnoreStart Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfterAmp
                        Hooks::run( 'ParserOptionsRegister', [
                                &self::$defaults,
                                &self::$inCacheKey,
                                &self::$lazyOptions,
                        ] );
+                       // @codingStandardsIgnoreEnd
 
                        ksort( self::$inCacheKey );
                }
index 3c750ad..2588962 100644 (file)
@@ -625,7 +625,7 @@ class Preprocessor_DOM extends Preprocessor {
                                $curLen = strlen( $curChar );
                                $count = ( $curLen > 1 ) ?
                                        # allow the final character to repeat
-                                       strspn( $text, $curChar[$curLen-1], $i+1 ) + 1 :
+                                       strspn( $text, $curChar[$curLen - 1], $i + 1 ) + 1 :
                                        strspn( $text, $curChar, $i );
 
                                # we need to add to stack only if opening brace count is enough for one of the rules
index 25d253f..9ea8fa3 100644 (file)
@@ -569,7 +569,7 @@ class Preprocessor_Hash extends Preprocessor {
                                $curLen = strlen( $curChar );
                                $count = ( $curLen > 1 ) ?
                                        # allow the final character to repeat
-                                       strspn( $text, $curChar[$curLen-1], $i+1 ) + 1 :
+                                       strspn( $text, $curChar[$curLen - 1], $i + 1 ) + 1 :
                                        strspn( $text, $curChar, $i );
 
                                # we need to add to stack only if opening brace count is enough for one of the rules
index db5ccaf..57bd01f 100644 (file)
@@ -298,7 +298,7 @@ class SectionProfiler {
                        /* Find all items under this entry */
                        $level = $stack[$max][1];
                        $working = [];
-                       for ( $i = $max -1; $i >= 0; $i-- ) {
+                       for ( $i = $max - 1; $i >= 0; $i-- ) {
                                if ( $stack[$i][1] > $level ) {
                                        $working[] = $stack[$i];
                                } else {
@@ -439,7 +439,7 @@ class SectionProfiler {
        protected function calltreeCount( $stack, $start ) {
                $level = $stack[$start][1];
                $count = 0;
-               for ( $i = $start -1; $i >= 0 && $stack[$i][1] > $level; $i-- ) {
+               for ( $i = $start - 1; $i >= 0 && $stack[$i][1] > $level; $i-- ) {
                        $count ++;
                }
                return $count;
index 70117db..3e78488 100644 (file)
@@ -138,7 +138,7 @@ abstract class SearchEngine {
         * @return mixed the feature value or null if unset
         */
        public function getFeatureData( $feature ) {
-               if ( isset ( $this->features[$feature] ) ) {
+               if ( isset( $this->features[$feature] ) ) {
                        return $this->features[$feature];
                }
                return null;
index 2c82c7d..3d4da42 100644 (file)
@@ -145,7 +145,7 @@ class SearchSqlite extends SearchDatabase {
                $searchChars = parent::legalSearchChars( $type );
                if ( $type === self::CHARS_ALL ) {
                        // " for phrase, * for wildcard
-                       $searchChars =  "\"*" . $searchChars;
+                       $searchChars = "\"*" . $searchChars;
                }
                return $searchChars;
        }
index 31e1590..a6e6339 100644 (file)
@@ -333,7 +333,7 @@ class Site implements Serializable {
         */
        public function getLinkPath() {
                $type = $this->getLinkPathType();
-               return $type === null ? null: $this->getPath( $type );
+               return $type === null ? null : $this->getPath( $type );
        }
 
        /**
index 2dccee1..0478409 100644 (file)
@@ -1156,7 +1156,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
                        // Don't show a "create account" link if the user can't.
                        if ( $this->showCreateAccountLink() ) {
                                // link to the other action
-                               $linkTitle = $this->getTitleFor( $this->isSignup() ? 'Userlogin' :'CreateAccount' );
+                               $linkTitle = $this->getTitleFor( $this->isSignup() ? 'Userlogin' : 'CreateAccount' );
                                $linkq = $this->getReturnToQueryStringFragment();
                                // Pass any language selection on to the mode switch link
                                if ( $this->mLanguage ) {
index d5c5528..8e6c446 100644 (file)
@@ -288,7 +288,7 @@ class SpecialExport extends SpecialPage {
                $formDescriptor += [
                        'wpDownload' => [
                                'type' => 'check',
-                               'name' =>'wpDownload',
+                               'name' => 'wpDownload',
                                'id' => 'wpDownload',
                                'default' => $request->wasPosted() ? $request->getCheck( 'wpDownload' ) : true,
                                'label-message' => 'export-download',
index 83efbcb..1312501 100644 (file)
@@ -197,7 +197,7 @@ class MediaStatisticsPage extends QueryPage {
                $row .= Html::rawElement(
                        'td',
                        // Make sure js sorts it in numeric order
-                       [ 'data-sort-value' =>  $bytes ],
+                       [ 'data-sort-value' => $bytes ],
                        $this->msg( 'mediastatistics-nbytes' )
                                ->numParams( $bytes )
                                ->sizeParams( $bytes )
index 4b0fa00..e1d4dd1 100644 (file)
@@ -73,28 +73,28 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        'success' => 'revdelete-success',
                        'failure' => 'revdelete-failure',
                        'text' => 'revdelete-text-text',
-                       'selected'=> 'revdelete-selected-text',
+                       'selected' => 'revdelete-selected-text',
                ],
                'archive' => [
                        'check-label' => 'revdelete-hide-text',
                        'success' => 'revdelete-success',
                        'failure' => 'revdelete-failure',
                        'text' => 'revdelete-text-text',
-                       'selected'=> 'revdelete-selected-text',
+                       'selected' => 'revdelete-selected-text',
                ],
                'oldimage' => [
                        'check-label' => 'revdelete-hide-image',
                        'success' => 'revdelete-success',
                        'failure' => 'revdelete-failure',
                        'text' => 'revdelete-text-file',
-                       'selected'=> 'revdelete-selected-file',
+                       'selected' => 'revdelete-selected-file',
                ],
                'filearchive' => [
                        'check-label' => 'revdelete-hide-image',
                        'success' => 'revdelete-success',
                        'failure' => 'revdelete-failure',
                        'text' => 'revdelete-text-file',
-                       'selected'=> 'revdelete-selected-file',
+                       'selected' => 'revdelete-selected-file',
                ],
                'logging' => [
                        'check-label' => 'revdelete-hide-name',
index d23625a..51ddc0b 100644 (file)
@@ -596,7 +596,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                // default string representation, for example, and would confuse comparisons.
 
                // Misleadingly, the 'days' option supports hours too.
-               $days = array_map( 'strval', [ 1/24, 2/24, 6/24, 12/24, 1, 3, 7 ] );
+               $days = array_map( 'strval', [ 1 / 24, 2 / 24, 6 / 24, 12 / 24, 1, 3, 7 ] );
 
                $userWatchlistOption = (string)$this->getUser()->getOption( 'watchlistdays' );
                // add the user preference, if it isn't available already
index cfcbf65..a35a420 100644 (file)
@@ -75,7 +75,7 @@ class LoginHelper extends ContextSource {
                // Allow modification of redirect behavior
                Hooks::run( 'PostLoginRedirect', [ &$returnTo, &$returnToQuery, &$type ] );
 
-               $returnToTitle = Title::newFromText( $returnTo ) ?:  Title::newMainPage();
+               $returnToTitle = Title::newFromText( $returnTo ) ?: Title::newMainPage();
 
                if ( $wgSecureLogin && !$stickHTTPS ) {
                        $options = [ 'http' ];
index cdb9130..a68fe66 100644 (file)
@@ -270,7 +270,7 @@ class UsersPager extends AlphabeticPager {
        function getPageHeader() {
                list( $self ) = explode( '/', $this->getTitle()->getPrefixedDBkey() );
 
-               $groupOptions = [ $this->msg( 'group-all' )->text() =>  '' ];
+               $groupOptions = [ $this->msg( 'group-all' )->text() => '' ];
                foreach ( $this->getAllGroups() as $group => $groupText ) {
                        $groupOptions[ $groupText ] = $group;
                }
index 4852ce5..b29a3af 100644 (file)
@@ -1203,7 +1203,7 @@ class BalanceStack implements IteratorAggregate {
                        $furthestBlock = null;
                        $furthestBlockIndex = -1;
                        $stackLength = $this->length();
-                       for ( $i = $index+1; $i < $stackLength; $i++ ) {
+                       for ( $i = $index + 1; $i < $stackLength; $i++ ) {
                                if ( $this->node( $i )->isA( BalanceSets::$specialSet ) ) {
                                        $furthestBlock = $this->node( $i );
                                        $furthestBlockIndex = $i;
@@ -1225,7 +1225,7 @@ class BalanceStack implements IteratorAggregate {
 
                        // Let the common ancestor be the element immediately above
                        // the formatting element in the stack of open elements.
-                       $ancestor = $this->node( $index-1 );
+                       $ancestor = $this->node( $index - 1 );
 
                        // Let a bookmark note the position of the formatting
                        // element in the list of active formatting elements
@@ -2116,7 +2116,7 @@ class Balancer {
                                return $this->insertToken( $token, $value, $attribs, $selfClose );
                        }
                        // "Any other start tag"
-                       $adjusted = ( $this->fragmentContext && $this->stack->length()===1 ) ?
+                       $adjusted = ( $this->fragmentContext && $this->stack->length() === 1 ) ?
                                $this->fragmentContext : $this->stack->currentNode;
                        $this->stack->insertForeignElement(
                                $adjusted->namespaceURI, $value, $attribs
@@ -2242,7 +2242,7 @@ class Balancer {
 
        private function switchMode( $mode ) {
                Assert::parameter(
-                       substr( $mode, -4 )==='Mode', '$mode', 'should end in Mode'
+                       substr( $mode, -4 ) === 'Mode', '$mode', 'should end in Mode'
                );
                $oldMode = $this->parseMode;
                $this->parseMode = $mode;
@@ -2267,8 +2267,8 @@ class Balancer {
                                switch ( $node->localName ) {
                                case 'select':
                                        $stackLength = $this->stack->length();
-                                       for ( $j = $i + 1; $j < $stackLength-1; $j++ ) {
-                                               $ancestor = $this->stack->node( $stackLength-$j-1 );
+                                       for ( $j = $i + 1; $j < $stackLength - 1; $j++ ) {
+                                               $ancestor = $this->stack->node( $stackLength - $j - 1 );
                                                if ( $ancestor->isHtmlNamed( 'template' ) ) {
                                                        break;
                                                }
index 9145bb6..81a1a43 100644 (file)
@@ -176,7 +176,7 @@ class InterwikiSearchResultSetWidget implements SearchResultSetWidget {
                $iwIconUrl = $parsed['scheme'] .
                        $parsed['delimiter'] .
                        $parsed['host'] .
-                       ( isset ( $parsed['port'] ) ? ':' . $parsed['port'] : '' ) .
+                       ( isset( $parsed['port'] ) ? ':' . $parsed['port'] : '' ) .
                        '/favicon.ico';
 
                $iwIcon = new OOUI\IconWidget( [
index bcd1c16..4eead5e 100644 (file)
@@ -61,6 +61,6 @@ class InterwikiSearchResultWidget implements SearchResultWidget {
                }
 
                return Html::rawElement( 'div', [ 'class' => 'iw-result__title' ], $link . ' ' . $redirect ) .
-                       Html::rawElement( 'div', [ 'class'=> 'iw-result__content' ], $snippet );
+                       Html::rawElement( 'div', [ 'class' => 'iw-result__content' ], $snippet );
        }
 }
index 92dad9b..fc7b21d 100644 (file)
@@ -1584,9 +1584,9 @@ class Language {
         * @return int[]
         */
        private static function tsToIranian( $ts ) {
-               $gy = substr( $ts, 0, 4 ) -1600;
-               $gm = substr( $ts, 4, 2 ) -1;
-               $gd = substr( $ts, 6, 2 ) -1;
+               $gy = substr( $ts, 0, 4 ) - 1600;
+               $gm = substr( $ts, 4, 2 ) - 1;
+               $gd = substr( $ts, 6, 2 ) - 1;
 
                # Days passed from the beginning (including leap years)
                $gDayNo = 365 * $gy
@@ -1666,7 +1666,7 @@ class Language {
                                                                (int)( ( 275 * $zm ) / 9 ) + $zd + 1729777;
                }
 
-               $zl = $zjd -1948440 + 10632;
+               $zl = $zjd - 1948440 + 10632;
                $zn = (int)( ( $zl - 1 ) / 10631 );
                $zl = $zl - 10631 * $zn + 354;
                $zj = ( (int)( ( 10985 - $zl ) / 5316 ) ) * ( (int)( ( 50 * $zl ) / 17719 ) ) +
@@ -3346,7 +3346,7 @@ class Language {
                                if ( $start < 0 ) {
                                        $start = 0;
                                }
-                               $groupedNumber = substr( $number, $start, $end -$start ) . $groupedNumber;
+                               $groupedNumber = substr( $number, $start, $end - $start ) . $groupedNumber;
                                $end = $start;
                                if ( $numMatches > 1 ) {
                                        // use the last pattern for the rest of the number
index f6f03c4..1a1438c 100644 (file)
@@ -282,7 +282,7 @@ class KkConverter extends LanguageConverter {
                $ret = '';
 
                foreach ( $matches as $m ) {
-                       $ret .= substr( $text, $mstart, $m[1] -$mstart );
+                       $ret .= substr( $text, $mstart, $m[1] - $mstart );
                        $ret .= $this->regsConverter( $m[0], $toVariant );
                        $mstart = $m[1] + strlen( $m[0] );
                }
index 6491f55..e0ff5e1 100644 (file)
@@ -131,7 +131,7 @@ class SrConverter extends LanguageConverter {
                $ret = $this->mTables[$toVariant]->replace( $m[0] );
                $mstart = $m[1] + strlen( $m[0] );
                foreach ( $matches as $m ) {
-                       $ret .= substr( $text, $mstart, $m[1] -$mstart );
+                       $ret .= substr( $text, $mstart, $m[1] - $mstart );
                        $ret .= parent::translate( $m[0], $toVariant );
                        $mstart = $m[1] + strlen( $m[0] );
                }
index 967224f..299beb8 100644 (file)
@@ -88,7 +88,7 @@ $defaultDateFormat = 'km';
 $dateFormats = [
        'km time' => 'ម៉ោងH:i',
        'km date' => 'l ទីd F ឆ្នាំY',
-       'km both' =>  'ម៉ោងH:i l ទីd F ឆ្នាំY',
+       'km both' => 'ម៉ោងH:i l ទីd F ឆ្នាំY',
 ];
 
 $specialPageAliases = [
index 2a102b2..c1aa082 100644 (file)
@@ -95,7 +95,7 @@ class HHVMMakeRepo extends Maintenance {
                print "Found " . count( $files ) . " files in " .
                        count( $dirs ) . " directories\n";
 
-               $tmpDir = wfTempDir() . '/mw-make-repo' . mt_rand( 0, 1<<31 );
+               $tmpDir = wfTempDir() . '/mw-make-repo' . mt_rand( 0, 1 << 31 );
                if ( !mkdir( $tmpDir ) ) {
                        $this->error( 'Unable to create temporary directory', 1 );
                }
index 578a226..b099aff 100644 (file)
@@ -448,7 +448,7 @@ class RefreshLinks extends Maintenance {
                do {
                        $finalConds = $conds;
                        $timestamp = $dbr->addQuotes( $timestamp );
-                       $finalConds []=
+                       $finalConds [] =
                                "(cl_timestamp > $timestamp OR (cl_timestamp = $timestamp AND cl_from > $lastId))";
                        $res = $dbr->select( [ 'page', 'categorylinks' ],
                                [ 'page_id', 'cl_timestamp' ],
index 4afe710..18e6e97 100644 (file)
@@ -300,7 +300,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                        'ConfigFactory',
                        self::makeTestConfigFactoryInstantiator(
                                $oldConfigFactory,
-                               [ 'main' =>  $bootstrapConfig ]
+                               [ 'main' => $bootstrapConfig ]
                        )
                );
                $newServices->resetServiceForTesting( 'DBLoadBalancerFactory' );
index 0015453..811c8c2 100644 (file)
@@ -84,7 +84,7 @@ class ChangesListFilterTest extends MediaWikiTestCase {
                        ]
                );
 
-               $groupB =  $this->getGroup(
+               $groupB = $this->getGroup(
                        [
                                'name' => 'groupB',
                                'filters' => [
index 19cffa2..c13cf25 100644 (file)
@@ -90,7 +90,7 @@ class EtcConfigTest extends PHPUnit_Framework_TestCase {
         */
        public function testConstructCacheSpec() {
                $config = $this->createConfigMock( [ 'cache' => [
-                       'class' =>  HashBagOStuff::class
+                       'class' => HashBagOStuff::class
                ] ] );
                $config->expects( $this->once() )->method( 'fetchAllFromEtcd' )
                        ->willReturn( [
index 48310a9..fd3b0b8 100644 (file)
@@ -39,7 +39,7 @@ class ClassicInterwikiLookupTest extends MediaWikiTestCase {
                $lookup = new \MediaWiki\Interwiki\ClassicInterwikiLookup(
                        Language::factory( 'en' ),
                        WANObjectCache::newEmpty(),
-                       60*60,
+                       60 * 60,
                        false,
                        3,
                        'en'
@@ -153,7 +153,7 @@ class ClassicInterwikiLookupTest extends MediaWikiTestCase {
                $lookup = new \MediaWiki\Interwiki\ClassicInterwikiLookup(
                        Language::factory( 'en' ),
                        WANObjectCache::newEmpty(),
-                       60*60,
+                       60 * 60,
                        $cdbFile,
                        3,
                        'en'
@@ -204,7 +204,7 @@ class ClassicInterwikiLookupTest extends MediaWikiTestCase {
                $lookup = new \MediaWiki\Interwiki\ClassicInterwikiLookup(
                        Language::factory( 'en' ),
                        WANObjectCache::newEmpty(),
-                       60*60,
+                       60 * 60,
                        $hash,
                        3,
                        'en'
index 99992fe..bb686fd 100644 (file)
@@ -51,7 +51,7 @@ class MockOggHandler extends OggHandlerTMH {
                        'length' => $this->getLength( $file ),
                        'offset' => $this->getOffset( $file ),
                        'width' => $targetWidth,
-                       'height' =>  $targetHeight,
+                       'height' => $targetHeight,
                        'isVideo' => !$this->isAudio( $file ),
                        'thumbtime' => isset(
                                $params['thumbtime']
@@ -59,7 +59,7 @@ class MockOggHandler extends OggHandlerTMH {
                        'start' => isset( $params['start'] ) ? $params['start'] : false,
                        'end' => isset( $params['end'] ) ? $params['end'] : false,
                        'fillwindow' => isset( $params['fillwindow'] ) ? $params['fillwindow'] : false,
-                       'disablecontrols' => isset ( $params['disablecontrols'] ) ? $params['disablecontrols'] : false
+                       'disablecontrols' => isset( $params['disablecontrols'] ) ? $params['disablecontrols'] : false
                ];
 
                // No thumbs for audio
index 71cf852..671bdf1 100644 (file)
@@ -42,17 +42,17 @@ mw.loader.implement( 'testUsesNestedMissing', function () {
 }, {}, {});
 ",
 
-       'testSkipped' =>"
+       'testSkipped' => "
 mw.loader.implement( 'testSkipped', function () {
        QUnit.ok( false, 'Module testSkipped was supposed to be skipped.' );
 }, {}, {});
 ",
 
-       'testNotSkipped' =>"
+       'testNotSkipped' => "
 mw.loader.implement( 'testNotSkipped', function () {}, {}, {});
 ",
 
-       'testUsesSkippable' =>"
+       'testUsesSkippable' => "
 mw.loader.implement( 'testUsesSkippable', function () {}, {}, {});
 ",
 ];