From 6df9ed1ad68c92b5e7364038ef3932c4739eb86e Mon Sep 17 00:00:00 2001 From: WMDE-Fisch Date: Fri, 11 Aug 2017 15:53:17 +0200 Subject: [PATCH] update mediawiki-codesniffer to 0.11.0 and fix issues - mostly auto fixes - some too long lines fixed - ignore amp space in one case passing by reference Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c --- composer.json | 2 +- includes/Block.php | 2 +- includes/DefaultSettings.php | 2 +- includes/EditPage.php | 2 +- includes/MovePage.php | 2 +- includes/RevisionList.php | 2 +- includes/Sanitizer.php | 5 ++- includes/api/ApiCSPReport.php | 2 +- includes/api/ApiQueryImageInfo.php | 34 +++++++++---------- includes/api/ApiQueryWatchlist.php | 2 +- includes/api/SearchApi.php | 2 +- includes/changes/ChangesListFilterGroup.php | 4 +-- includes/changes/OldChangesList.php | 2 +- .../filebackend/filejournal/DBFileJournal.php | 2 +- includes/installer/Installer.php | 2 +- includes/libs/composer/ComposerInstalled.php | 2 +- includes/libs/composer/ComposerLock.php | 2 +- includes/parser/Parser.php | 2 +- includes/parser/ParserOptions.php | 2 ++ includes/parser/Preprocessor_DOM.php | 2 +- includes/parser/Preprocessor_Hash.php | 2 +- includes/profiler/SectionProfiler.php | 4 +-- includes/search/SearchEngine.php | 2 +- includes/search/SearchSqlite.php | 2 +- includes/site/Site.php | 2 +- .../specialpage/LoginSignupSpecialPage.php | 2 +- includes/specials/SpecialExport.php | 2 +- includes/specials/SpecialMediaStatistics.php | 2 +- includes/specials/SpecialRevisiondelete.php | 8 ++--- includes/specials/SpecialWatchlist.php | 2 +- includes/specials/helpers/LoginHelper.php | 2 +- includes/specials/pagers/UsersPager.php | 2 +- includes/tidy/Balancer.php | 12 +++---- .../search/InterwikiSearchResultSetWidget.php | 2 +- .../search/InterwikiSearchResultWidget.php | 2 +- languages/Language.php | 10 +++--- languages/classes/LanguageKk.php | 2 +- languages/classes/LanguageSr.php | 2 +- languages/messages/MessagesKm.php | 2 +- maintenance/hhvm/makeRepo.php | 2 +- maintenance/refreshLinks.php | 2 +- tests/phpunit/MediaWikiTestCase.php | 2 +- .../changes/ChangesListFilterTest.php | 2 +- .../includes/config/EtcdConfigTest.php | 2 +- .../interwiki/ClassicInterwikiLookupTest.php | 6 ++-- tests/phpunit/mocks/media/MockOggHandler.php | 4 +-- tests/qunit/data/load.mock.php | 6 ++-- 47 files changed, 86 insertions(+), 81 deletions(-) diff --git a/composer.json b/composer.json index bc48360283..32933e67a6 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/includes/Block.php b/includes/Block.php index 8fc2686305..843ea54484 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -1501,7 +1501,7 @@ class Block { return $id; } $hmac = MWCryptHash::hmac( $id, $secretKey, false ); - $cookieValue = $id . '!' . $hmac; + $cookieValue = $id . '!' . $hmac; return $cookieValue; } diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index a28aa5b3f5..ba755fa1a2 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 ], ]; /** diff --git a/includes/EditPage.php b/includes/EditPage.php index cc27e88a56..49341c5e7e 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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'; } diff --git a/includes/MovePage.php b/includes/MovePage.php index 8d0c33dcc2..39dc6424db 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -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 ); diff --git a/includes/RevisionList.php b/includes/RevisionList.php index ccdedb8e61..b0bc60a188 100644 --- a/includes/RevisionList.php +++ b/includes/RevisionList.php @@ -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() { diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index b6b7922615..ed09701d4b 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -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 ); diff --git a/includes/api/ApiCSPReport.php b/includes/api/ApiCSPReport.php index 3a78c1350c..9ad24c19f3 100644 --- a/includes/api/ApiCSPReport.php +++ b/includes/api/ApiCSPReport.php @@ -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__ ); } diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index bfd5b17b7d..7b0080eb23 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -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', ]; } diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index f8f6e7d8a1..9883480500 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -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 ); diff --git a/includes/api/SearchApi.php b/includes/api/SearchApi.php index 552292bc36..f7c6471e7c 100644 --- a/includes/api/SearchApi.php +++ b/includes/api/SearchApi.php @@ -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'] ) ) { diff --git a/includes/changes/ChangesListFilterGroup.php b/includes/changes/ChangesListFilterGroup.php index 0dc1145491..57627525a3 100644 --- a/includes/changes/ChangesListFilterGroup.php +++ b/includes/changes/ChangesListFilterGroup.php @@ -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; diff --git a/includes/changes/OldChangesList.php b/includes/changes/OldChangesList.php index 4c4fb7e963..4d6187b830 100644 --- a/includes/changes/OldChangesList.php +++ b/includes/changes/OldChangesList.php @@ -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; diff --git a/includes/filebackend/filejournal/DBFileJournal.php b/includes/filebackend/filejournal/DBFileJournal.php index 42b36ffe9c..4269f91ef9 100644 --- a/includes/filebackend/filejournal/DBFileJournal.php +++ b/includes/filebackend/filejournal/DBFileJournal.php @@ -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 ); } diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index a29d9875a5..46aa518870 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -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 = []; diff --git a/includes/libs/composer/ComposerInstalled.php b/includes/libs/composer/ComposerInstalled.php index 9f15078c64..ef2b768d0b 100644 --- a/includes/libs/composer/ComposerInstalled.php +++ b/includes/libs/composer/ComposerInstalled.php @@ -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'] : '', ]; } diff --git a/includes/libs/composer/ComposerLock.php b/includes/libs/composer/ComposerLock.php index 818ccdf3a2..dc8bc035b2 100644 --- a/includes/libs/composer/ComposerLock.php +++ b/includes/libs/composer/ComposerLock.php @@ -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'] : '', ]; } diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 74ffc888eb..326100280d 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -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, ]; diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 5e2845ffe2..c7146a1306 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -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 ); } diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 3c750ad7dc..2588962604 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -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 diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 25d253f9b9..9ea8fa3a50 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -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 diff --git a/includes/profiler/SectionProfiler.php b/includes/profiler/SectionProfiler.php index db5ccafe4b..57bd01f8de 100644 --- a/includes/profiler/SectionProfiler.php +++ b/includes/profiler/SectionProfiler.php @@ -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; diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 70117db76c..3e78488803 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -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; diff --git a/includes/search/SearchSqlite.php b/includes/search/SearchSqlite.php index 2c82c7d9a5..3d4da42ce8 100644 --- a/includes/search/SearchSqlite.php +++ b/includes/search/SearchSqlite.php @@ -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; } diff --git a/includes/site/Site.php b/includes/site/Site.php index 31e1590933..a6e63391da 100644 --- a/includes/site/Site.php +++ b/includes/site/Site.php @@ -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 ); } /** diff --git a/includes/specialpage/LoginSignupSpecialPage.php b/includes/specialpage/LoginSignupSpecialPage.php index 2dccee1f8c..0478409a1a 100644 --- a/includes/specialpage/LoginSignupSpecialPage.php +++ b/includes/specialpage/LoginSignupSpecialPage.php @@ -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 ) { diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index d5c5528d7a..8e6c446238 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -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', diff --git a/includes/specials/SpecialMediaStatistics.php b/includes/specials/SpecialMediaStatistics.php index 83efbcbdbc..1312501577 100644 --- a/includes/specials/SpecialMediaStatistics.php +++ b/includes/specials/SpecialMediaStatistics.php @@ -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 ) diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 4b0fa008b6..e1d4dd1b5d 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -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', diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index d23625a165..51ddc0ba0b 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -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 diff --git a/includes/specials/helpers/LoginHelper.php b/includes/specials/helpers/LoginHelper.php index cfcbf652c0..a35a420ee6 100644 --- a/includes/specials/helpers/LoginHelper.php +++ b/includes/specials/helpers/LoginHelper.php @@ -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' ]; diff --git a/includes/specials/pagers/UsersPager.php b/includes/specials/pagers/UsersPager.php index cdb9130bc0..a68fe66881 100644 --- a/includes/specials/pagers/UsersPager.php +++ b/includes/specials/pagers/UsersPager.php @@ -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; } diff --git a/includes/tidy/Balancer.php b/includes/tidy/Balancer.php index 4852ce5211..b29a3afbd4 100644 --- a/includes/tidy/Balancer.php +++ b/includes/tidy/Balancer.php @@ -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; } diff --git a/includes/widget/search/InterwikiSearchResultSetWidget.php b/includes/widget/search/InterwikiSearchResultSetWidget.php index 9145bb66aa..81a1a43111 100644 --- a/includes/widget/search/InterwikiSearchResultSetWidget.php +++ b/includes/widget/search/InterwikiSearchResultSetWidget.php @@ -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( [ diff --git a/includes/widget/search/InterwikiSearchResultWidget.php b/includes/widget/search/InterwikiSearchResultWidget.php index bcd1c16f4d..4eead5e7e9 100644 --- a/includes/widget/search/InterwikiSearchResultWidget.php +++ b/includes/widget/search/InterwikiSearchResultWidget.php @@ -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 ); } } diff --git a/languages/Language.php b/languages/Language.php index 92dad9b134..fc7b21df3c 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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 diff --git a/languages/classes/LanguageKk.php b/languages/classes/LanguageKk.php index f6f03c48af..1a1438c6b2 100644 --- a/languages/classes/LanguageKk.php +++ b/languages/classes/LanguageKk.php @@ -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] ); } diff --git a/languages/classes/LanguageSr.php b/languages/classes/LanguageSr.php index 6491f55140..e0ff5e1676 100644 --- a/languages/classes/LanguageSr.php +++ b/languages/classes/LanguageSr.php @@ -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] ); } diff --git a/languages/messages/MessagesKm.php b/languages/messages/MessagesKm.php index 967224fec9..299beb8f25 100644 --- a/languages/messages/MessagesKm.php +++ b/languages/messages/MessagesKm.php @@ -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 = [ diff --git a/maintenance/hhvm/makeRepo.php b/maintenance/hhvm/makeRepo.php index 2a102b2486..c1aa082039 100644 --- a/maintenance/hhvm/makeRepo.php +++ b/maintenance/hhvm/makeRepo.php @@ -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 ); } diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php index 578a226c91..b099aff44f 100644 --- a/maintenance/refreshLinks.php +++ b/maintenance/refreshLinks.php @@ -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' ], diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 4afe710580..18e6e97d5d 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -300,7 +300,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { 'ConfigFactory', self::makeTestConfigFactoryInstantiator( $oldConfigFactory, - [ 'main' => $bootstrapConfig ] + [ 'main' => $bootstrapConfig ] ) ); $newServices->resetServiceForTesting( 'DBLoadBalancerFactory' ); diff --git a/tests/phpunit/includes/changes/ChangesListFilterTest.php b/tests/phpunit/includes/changes/ChangesListFilterTest.php index 0015453de9..811c8c2b72 100644 --- a/tests/phpunit/includes/changes/ChangesListFilterTest.php +++ b/tests/phpunit/includes/changes/ChangesListFilterTest.php @@ -84,7 +84,7 @@ class ChangesListFilterTest extends MediaWikiTestCase { ] ); - $groupB = $this->getGroup( + $groupB = $this->getGroup( [ 'name' => 'groupB', 'filters' => [ diff --git a/tests/phpunit/includes/config/EtcdConfigTest.php b/tests/phpunit/includes/config/EtcdConfigTest.php index 19cffa29b9..c13cf2517c 100644 --- a/tests/phpunit/includes/config/EtcdConfigTest.php +++ b/tests/phpunit/includes/config/EtcdConfigTest.php @@ -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( [ diff --git a/tests/phpunit/includes/interwiki/ClassicInterwikiLookupTest.php b/tests/phpunit/includes/interwiki/ClassicInterwikiLookupTest.php index 48310a9f41..fd3b0b856a 100644 --- a/tests/phpunit/includes/interwiki/ClassicInterwikiLookupTest.php +++ b/tests/phpunit/includes/interwiki/ClassicInterwikiLookupTest.php @@ -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' diff --git a/tests/phpunit/mocks/media/MockOggHandler.php b/tests/phpunit/mocks/media/MockOggHandler.php index 99992fe3d8..bb686fd846 100644 --- a/tests/phpunit/mocks/media/MockOggHandler.php +++ b/tests/phpunit/mocks/media/MockOggHandler.php @@ -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 diff --git a/tests/qunit/data/load.mock.php b/tests/qunit/data/load.mock.php index 71cf852a91..671bdf1fc2 100644 --- a/tests/qunit/data/load.mock.php +++ b/tests/qunit/data/load.mock.php @@ -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 () {}, {}, {}); ", ]; -- 2.20.1