From 9f5b6f5aeb292df1651666a6558e2ff1c74c565d Mon Sep 17 00:00:00 2001 From: Vivek Ghaisas Date: Tue, 16 Jun 2015 22:06:19 +0300 Subject: [PATCH] Fix whitespace issues around parentheses Fix issues found by MediaWiki.WhiteSpace.SpaceyParenthesis sniff. Bug: T102617 Change-Id: Iec7f71e64081659fba373ec20d9d2006306a98f4 --- docs/doxygen_first_page.php | 2 +- includes/AjaxResponse.php | 18 +++++++------- includes/Block.php | 2 +- includes/CategoryViewer.php | 2 +- includes/GlobalFunctions.php | 8 +++---- includes/Setup.php | 4 ++-- includes/StreamFile.php | 2 +- includes/api/ApiEditPage.php | 2 +- includes/api/ApiExpandTemplates.php | 2 +- includes/api/ApiParse.php | 2 +- includes/api/ApiQuerySearch.php | 2 +- includes/debug/logger/LegacyLogger.php | 2 +- includes/diff/DifferenceEngine.php | 2 +- includes/installer/MssqlUpdater.php | 2 +- includes/json/FormatJson.php | 2 +- includes/media/XMP.php | 2 +- includes/parser/Parser.php | 4 ++-- includes/profiler/ProfilerFunctions.php | 2 +- includes/search/SearchHighlighter.php | 2 +- includes/specialpage/QueryPage.php | 2 +- includes/specials/SpecialJavaScriptTest.php | 2 +- includes/specials/SpecialMediaStatistics.php | 4 ++-- includes/specials/SpecialUserrights.php | 4 ++-- languages/Language.php | 4 ++-- languages/classes/LanguageEo.php | 2 +- languages/classes/LanguageFi.php | 4 ++-- languages/classes/LanguageKsh.php | 2 +- .../convertExtensionToRegistration.php | 2 +- maintenance/validateRegistrationFile.php | 4 ++-- tests/phpunit/includes/LinkFilterTest.php | 12 +++++----- tests/phpunit/includes/MovePageTest.php | 2 +- tests/phpunit/includes/OutputPageTest.php | 24 +++++++++---------- tests/phpunit/includes/StatusTest.php | 4 ++-- tests/phpunit/includes/TitleTest.php | 2 +- tests/phpunit/includes/api/ApiBlockTest.php | 2 +- .../phpunit/includes/api/ApiEditPageTest.php | 4 ++-- tests/phpunit/includes/api/ApiUnblockTest.php | 2 +- .../includes/config/HashConfigTest.php | 2 +- .../includes/content/JsonContentTest.php | 2 +- .../includes/db/DatabaseMysqlBaseTest.php | 2 +- .../includes/diff/ArrayDiffFormatterTest.php | 4 ++-- .../includes/exception/MWExceptionTest.php | 2 +- .../phpunit/includes/libs/ArrayUtilsTest.php | 2 +- tests/phpunit/includes/libs/XhprofTest.php | 16 ++++++------- .../objectcache/WANObjectCacheTest.php | 2 +- .../ResourceLoaderFileModuleTest.php | 2 +- .../resourceloader/ResourceLoaderTest.php | 2 +- .../includes/title/ForeignTitleTest.php | 4 ++-- .../title/MediaWikiPageLinkRendererTest.php | 2 +- .../languages/classes/LanguageArqTest.php | 2 +- .../maintenance/backupTextPassTest.php | 2 +- tests/testHelpers.inc | 2 +- thumb.php | 2 +- 53 files changed, 98 insertions(+), 98 deletions(-) diff --git a/docs/doxygen_first_page.php b/docs/doxygen_first_page.php index 9949d13366..77ae1dcf36 100644 --- a/docs/doxygen_first_page.php +++ b/docs/doxygen_first_page.php @@ -1,5 +1,5 @@ mContentType ); + header( "Content-Type: " . $this->mContentType ); if ( $this->mLastModified ) { - header ( "Last-Modified: " . $this->mLastModified ); + header( "Last-Modified: " . $this->mLastModified ); } else { - header ( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); + header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); } if ( $this->mCacheDuration ) { @@ -193,20 +193,20 @@ class AjaxResponse { } else { # Let the client do the caching. Cache is not purged. - header ( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $this->mCacheDuration ) . " GMT" ); - header ( "Cache-Control: s-maxage={$this->mCacheDuration}," . + header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $this->mCacheDuration ) . " GMT" ); + header( "Cache-Control: s-maxage={$this->mCacheDuration}," . "public,max-age={$this->mCacheDuration}" ); } } else { # always expired, always modified - header ( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); // Date in the past - header ( "Cache-Control: no-cache, must-revalidate" ); // HTTP/1.1 - header ( "Pragma: no-cache" ); // HTTP/1.0 + header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); // Date in the past + header( "Cache-Control: no-cache, must-revalidate" ); // HTTP/1.1 + header( "Pragma: no-cache" ); // HTTP/1.0 } if ( $this->mVary ) { - header ( "Vary: " . $this->mVary ); + header( "Vary: " . $this->mVary ); } } diff --git a/includes/Block.php b/includes/Block.php index d58220144a..85cfe59399 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -1109,7 +1109,7 @@ class Block { $blocks = array(); foreach ( $rows as $row ) { $block = self::newFromRow( $row ); - if ( !$block->deleteIfExpired() ) { + if ( !$block->deleteIfExpired() ) { $blocks[] = $block; } } diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index 66079c0179..e2c31a66ff 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -329,7 +329,7 @@ class CategoryViewer extends ContextSource { 'category' => array( 'LEFT JOIN', array( 'cat_title = page_title', 'page_namespace' => NS_CATEGORY - )) + ) ) ) ); diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 7a9b27bbf5..e2e06669ca 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1756,7 +1756,7 @@ function wfMsgExt( $key, $options ) { } if ( in_array( 'escape', $options, true ) ) { - $string = htmlspecialchars ( $string ); + $string = htmlspecialchars( $string ); } elseif ( in_array( 'escapenoentities', $options, true ) ) { $string = Sanitizer::escapeHtmlAllowEntities( $string ); } @@ -2758,7 +2758,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(), $useLogPipe = false; if ( is_executable( '/bin/bash' ) ) { - $time = intval ( isset( $limits['time'] ) ? $limits['time'] : $wgMaxShellTime ); + $time = intval( isset( $limits['time'] ) ? $limits['time'] : $wgMaxShellTime ); if ( isset( $limits['walltime'] ) ) { $wallTime = intval( $limits['walltime'] ); } elseif ( isset( $limits['time'] ) ) { @@ -2766,8 +2766,8 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(), } else { $wallTime = intval( $wgMaxShellWallClockTime ); } - $mem = intval ( isset( $limits['memory'] ) ? $limits['memory'] : $wgMaxShellMemory ); - $filesize = intval ( isset( $limits['filesize'] ) ? $limits['filesize'] : $wgMaxShellFileSize ); + $mem = intval( isset( $limits['memory'] ) ? $limits['memory'] : $wgMaxShellMemory ); + $filesize = intval( isset( $limits['filesize'] ) ? $limits['filesize'] : $wgMaxShellFileSize ); if ( $time > 0 || $mem > 0 || $filesize > 0 || $wallTime > 0 ) { $cmd = '/bin/bash ' . escapeshellarg( "$IP/includes/limit.sh" ) . ' ' . diff --git a/includes/Setup.php b/includes/Setup.php index 8462f68f2e..2fa9de1d29 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -369,7 +369,7 @@ if ( $wgResourceLoaderMaxQueryLength === false ) { } else { $wgResourceLoaderMaxQueryLength = 2000; } - unset($suhosinMaxValueLength); + unset( $suhosinMaxValueLength ); } /** @@ -429,7 +429,7 @@ if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) { } // Blacklisted file extensions shouldn't appear on the "allowed" list -$wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) ); +$wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) ); if ( $wgInvalidateCacheOnLocalSettingsChange ) { MediaWiki\suppressWarnings(); diff --git a/includes/StreamFile.php b/includes/StreamFile.php index bac4db65fb..3f73ae3ccd 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -78,7 +78,7 @@ class StreamFile { ) { if ( !is_array( $info ) ) { if ( $sendErrors ) { - HttpStatus::header( 404 ); + HttpStatus::header( 404 ); header( 'Cache-Control: no-cache' ); header( 'Content-Type: text/html; charset=utf-8' ); $encFile = htmlspecialchars( $path ); diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index aad71b9b53..6189f68e07 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -246,7 +246,7 @@ class ApiEditPage extends ApiBase { $titleObj->getNextRevisionID( $undoafterRev->getID() ) == $params['undo'] ) { $params['summary'] = wfMessage( 'undo-summary' ) - ->params ( $params['undo'], $undoRev->getUserText() )->inContentLanguage()->text(); + ->params( $params['undo'], $undoRev->getUserText() )->inContentLanguage()->text(); } } diff --git a/includes/api/ApiExpandTemplates.php b/includes/api/ApiExpandTemplates.php index 966af5306d..6112534cf2 100644 --- a/includes/api/ApiExpandTemplates.php +++ b/includes/api/ApiExpandTemplates.php @@ -162,7 +162,7 @@ class ApiExpandTemplates extends ApiBase { !isset( $prop['jsconfigvars'] ) && !isset( $prop['encodedjsconfigvars'] ) ) { $this->setWarning( "Property 'modules' was set but not 'jsconfigvars' " . "or 'encodedjsconfigvars'. Configuration variables are necessary " . - "for proper module usage."); + "for proper module usage." ); } } } diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 1833434e32..fa6f30e57b 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -376,7 +376,7 @@ class ApiParse extends ApiBase { !isset( $prop['jsconfigvars'] ) && !isset( $prop['encodedjsconfigvars'] ) ) { $this->setWarning( "Property 'modules' was set but not 'jsconfigvars' " . "or 'encodedjsconfigvars'. Configuration variables are necessary " . - "for proper module usage."); + "for proper module usage." ); } if ( isset( $prop['indicators'] ) ) { diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index 90af15a4cd..349e7fa651 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -238,7 +238,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { // Add item to results and see whether it fits $fit = $apiResult->addValue( - array( 'query', 'interwiki' . $this->getModuleName(), $result->getInterwikiPrefix() ), + array( 'query', 'interwiki' . $this->getModuleName(), $result->getInterwikiPrefix() ), null, $vals ); diff --git a/includes/debug/logger/LegacyLogger.php b/includes/debug/logger/LegacyLogger.php index 71fc328e67..6bd6411872 100644 --- a/includes/debug/logger/LegacyLogger.php +++ b/includes/debug/logger/LegacyLogger.php @@ -181,7 +181,7 @@ class LegacyLogger extends AbstractLogger { } elseif ( $channel === 'profileoutput' ) { // Legacy wfLogProfilingData formatitng $forward = ''; - if ( isset( $context['forwarded_for'] )) { + if ( isset( $context['forwarded_for'] ) ) { $forward = " forwarded for {$context['forwarded_for']}"; } if ( isset( $context['client_ip'] ) ) { diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 07a0522135..ac29ae0238 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -1040,7 +1040,7 @@ class DifferenceEngine extends ContextSource { $key = $title->quickUserCan( 'edit', $user ) ? 'editold' : 'viewsourceold'; $msg = $this->msg( $key )->escaped(); $editLink = $this->msg( 'parentheses' )->rawParams( - Linker::linkKnown( $title, $msg, array( ), $editQuery ) )->escaped(); + Linker::linkKnown( $title, $msg, array(), $editQuery ) )->escaped(); $header .= ' ' . Html::rawElement( 'span', array( 'class' => 'mw-diff-edit' ), diff --git a/includes/installer/MssqlUpdater.php b/includes/installer/MssqlUpdater.php index 5eef335532..164cfab499 100644 --- a/includes/installer/MssqlUpdater.php +++ b/includes/installer/MssqlUpdater.php @@ -41,7 +41,7 @@ class MssqlUpdater extends DatabaseUpdater { array( 'addField', 'mwuser', 'user_password_expires', 'patch-user_password_expires.sql' ), // 1.24 - array( 'addField', 'page', 'page_lang', 'patch-page-page_lang.sql'), + array( 'addField', 'page', 'page_lang', 'patch-page-page_lang.sql' ), // 1.25 array( 'dropTable', 'hitcounter' ), diff --git a/includes/json/FormatJson.php b/includes/json/FormatJson.php index 095811ff53..f85ee920da 100644 --- a/includes/json/FormatJson.php +++ b/includes/json/FormatJson.php @@ -380,7 +380,7 @@ class FormatJson { $inComment = false; $multiline = false; - for ($idx = 0; $idx < $maxLen; $idx++) { + for ( $idx = 0; $idx < $maxLen; $idx++ ) { switch ( $str[$idx] ) { case '"': $lookBehind = ( $idx - 1 >= 0 ) ? $str[$idx - 1] : ''; diff --git a/includes/media/XMP.php b/includes/media/XMP.php index 3fb86ba116..b9d0ae5868 100644 --- a/includes/media/XMP.php +++ b/includes/media/XMP.php @@ -415,7 +415,7 @@ class XMPReader implements LoggerAwareInterface { $len = unpack( 'Nlength/Noffset', substr( $content, 32, 8 ) ); if ( !$len || $len['length'] < 4 || $len['offset'] < 0 || $len['offset'] > $len['length'] ) { - $this->logger->info( __METHOD__ . 'Error reading extended XMP block, invalid length or offset.' ); + $this->logger->info( __METHOD__ . 'Error reading extended XMP block, invalid length or offset.' ); return false; } diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 928c3a82a7..432e12a558 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -1438,7 +1438,7 @@ class Parser { '-' => '', ' ' => '', 'x' => 'X', - )); + ) ); $titleObj = SpecialPage::getTitleFor( 'Booksources', $num ); return ' $line ) { diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index 92409cd652..bd3b55bd5f 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -70,7 +70,7 @@ abstract class QueryPage extends SpecialPage { array( 'DeadendPagesPage', 'Deadendpages' ), array( 'DoubleRedirectsPage', 'DoubleRedirects' ), array( 'FileDuplicateSearchPage', 'FileDuplicateSearch' ), - array( 'ListDuplicatedFilesPage', 'ListDuplicatedFiles'), + array( 'ListDuplicatedFilesPage', 'ListDuplicatedFiles' ), array( 'LinkSearchPage', 'LinkSearch' ), array( 'ListredirectsPage', 'Listredirects' ), array( 'LonelyPagesPage', 'Lonelypages' ), diff --git a/includes/specials/SpecialJavaScriptTest.php b/includes/specials/SpecialJavaScriptTest.php index e9639e1944..d330b0e846 100644 --- a/includes/specials/SpecialJavaScriptTest.php +++ b/includes/specials/SpecialJavaScriptTest.php @@ -229,7 +229,7 @@ HTML; // writes a script tag (the one loading mediawiki.js). Script tags are synchronous, block // each other, and run in order. But they don't nest. The code appended after the startup // module runs before the added script tag is parsed and executed. - echo Xml::encodeJsCall( 'document.write', array( Html::inlineScript( $code ) ) ); + echo Xml::encodeJsCall( 'document.write', array( Html::inlineScript( $code ) ) ); } private function plainQUnit() { diff --git a/includes/specials/SpecialMediaStatistics.php b/includes/specials/SpecialMediaStatistics.php index 8f14a41e4f..7a7979c4ae 100644 --- a/includes/specials/SpecialMediaStatistics.php +++ b/includes/specials/SpecialMediaStatistics.php @@ -236,7 +236,7 @@ class MediaStatisticsPage extends QueryPage { 'mw-mediastats-table-' . strtolower( $mediaType ), 'sortable', 'wikitable' - )) + ) ) ) ); $this->getOutput()->addHTML( $this->getTableHeaderRow() ); @@ -275,7 +275,7 @@ class MediaStatisticsPage extends QueryPage { array( 'class' => array( 'mw-mediastats-mediatype', 'mw-mediastats-mediatype-' . strtolower( $mediaType ) - )), + ) ), // for grep // mediastatistics-header-unknown, mediastatistics-header-bitmap, // mediastatistics-header-drawing, mediastatistics-header-audio, diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index 758e3c05a3..ab539515d2 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -249,7 +249,7 @@ class UserrightsPage extends SpecialPage { if ( $remove ) { foreach ( $remove as $index => $group ) { if ( !$user->removeGroup( $group ) ) { - unset($remove[$index]); + unset( $remove[$index] ); } } $newGroups = array_diff( $newGroups, $remove ); @@ -257,7 +257,7 @@ class UserrightsPage extends SpecialPage { if ( $add ) { foreach ( $add as $index => $group ) { if ( !$user->addGroup( $group ) ) { - unset($add[$index]); + unset( $add[$index] ); } } $newGroups = array_merge( $newGroups, $add ); diff --git a/languages/Language.php b/languages/Language.php index 0a61be69c1..b1d88bce38 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1336,7 +1336,7 @@ class Language { case 'xmn': $usedHijriMonth = true; if ( !$hijri ) { - $hijri = self::tsToHijri ( $ts ); + $hijri = self::tsToHijri( $ts ); } $num = $hijri[1]; break; @@ -3444,7 +3444,7 @@ class Language { // the string does not have any number part. Eg: .12345 return $sign . $groupedNumber; } - $start = $end = ($integerPart) ? strlen( $integerPart[0] ) : 0; + $start = $end = ( $integerPart ) ? strlen( $integerPart[0] ) : 0; while ( $start > 0 ) { $match = $matches[0][$numMatches - 1]; $matchLen = strlen( $match ); diff --git a/languages/classes/LanguageEo.php b/languages/classes/LanguageEo.php index 15fc8c037f..1b7dbfa504 100644 --- a/languages/classes/LanguageEo.php +++ b/languages/classes/LanguageEo.php @@ -61,7 +61,7 @@ class LanguageEo extends Language { */ function iconv( $in, $out, $string ) { if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) { - return preg_replace_callback ( + return preg_replace_callback( '/([cghjsu]x?)((?:xx)*)(?!x)/i', array( $this, 'strrtxuCallback' ), $string ); } elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) { diff --git a/languages/classes/LanguageFi.php b/languages/classes/LanguageFi.php index 2379caca96..a96b0a9e1d 100644 --- a/languages/classes/LanguageFi.php +++ b/languages/classes/LanguageFi.php @@ -149,10 +149,10 @@ class LanguageFi extends Language { ); $final = ''; - $tokens = explode ( ' ', $str ); + $tokens = explode( ' ', $str ); foreach ( $tokens as $item ) { if ( !is_numeric( $item ) ) { - if ( count ( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) { + if ( count( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) { list( $yyyy, $mm, $dd ) = explode( '-', $item ); $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" ); continue; diff --git a/languages/classes/LanguageKsh.php b/languages/classes/LanguageKsh.php index 6b6c95d11a..ddd866f50e 100644 --- a/languages/classes/LanguageKsh.php +++ b/languages/classes/LanguageKsh.php @@ -91,7 +91,7 @@ class LanguageKsh extends Language { function convertGrammar( $word, $case ) { $lord = strtolower( $word ); $gender = 'm'; // Nuutnaarel // default - if ( preg_match ( '/wiki$/', $lord ) ) { + if ( preg_match( '/wiki$/', $lord ) ) { $gender = 'n'; // Dat xyz-wiki } if ( isset( self::$familygender[$lord] ) ) { diff --git a/maintenance/convertExtensionToRegistration.php b/maintenance/convertExtensionToRegistration.php index 8adae2d38c..ce95e3a010 100644 --- a/maintenance/convertExtensionToRegistration.php +++ b/maintenance/convertExtensionToRegistration.php @@ -182,7 +182,7 @@ class ConvertExtensionToRegistration extends Maintenance { $this->json[$realName] = $out; } - protected function handleCredits( $realName, $value) { + protected function handleCredits( $realName, $value ) { $keys = array_keys( $value ); $this->json['type'] = $keys[0]; $values = array_values( $value ); diff --git a/maintenance/validateRegistrationFile.php b/maintenance/validateRegistrationFile.php index 08af11a341..9cf7b2bdc8 100644 --- a/maintenance/validateRegistrationFile.php +++ b/maintenance/validateRegistrationFile.php @@ -18,7 +18,7 @@ class ValidateRegistrationFile extends Maintenance { $this->error( "$path is not a valid JSON file.", 1 ); } if ( !isset( $data->manifest_version ) ) { - $this->output("Warning: No manifest_version set, assuming 1.\n" ); + $this->output( "Warning: No manifest_version set, assuming 1.\n" ); // For backwards-compatability assume 1 $data->manifest_version = 1; } @@ -39,7 +39,7 @@ class ValidateRegistrationFile extends Maintenance { . ExtensionRegistry::MANIFEST_VERSION . "\n" ); } $retriever = new JsonSchema\Uri\UriRetriever(); - $schema = $retriever->retrieve('file://' . $schemaPath ); + $schema = $retriever->retrieve( 'file://' . $schemaPath ); $validator = new JsonSchema\Validator(); $validator->check( $data, $schema ); diff --git a/tests/phpunit/includes/LinkFilterTest.php b/tests/phpunit/includes/LinkFilterTest.php index f2c9cb43a2..68081059f9 100644 --- a/tests/phpunit/includes/LinkFilterTest.php +++ b/tests/phpunit/includes/LinkFilterTest.php @@ -76,7 +76,7 @@ class LinkFilterTest extends MediaWikiLangTestCase { array( 'https://', '*.com', 'https://name:pass@secure.com/index.html' ), array( 'http://', 'name:pass@test.com', 'http://test.com' ), array( 'http://', 'test.com', 'http://name:pass@test.com' ), - array( 'http://', '*.test.com', 'http://a.b.c.test.com/dir/dir/file?a=6'), + array( 'http://', '*.test.com', 'http://a.b.c.test.com/dir/dir/file?a=6' ), array( null, 'http://*.test.com', 'http://www.test.com' ), array( 'mailto:', 'name@mail.test123.com', 'mailto:name@mail.test123.com' ), array( '', @@ -122,8 +122,8 @@ class LinkFilterTest extends MediaWikiLangTestCase { array( '', 'git://github.com/prwef/abc-def.git', 'git://github.com/prwef/abc-def.git' ), array( 'git://', 'github.com/', 'git://github.com/prwef/abc-def.git' ), array( 'git://', '*.github.com/', 'git://a.b.c.d.e.f.github.com/prwef/abc-def.git' ), - array( '', 'gopher://*.test.com/', 'gopher://gopher.test.com/0/v2/vstat'), - array( 'telnet://', '*.test.com', 'telnet://shell.test.com/~home/'), + array( '', 'gopher://*.test.com/', 'gopher://gopher.test.com/0/v2/vstat' ), + array( 'telnet://', '*.test.com', 'telnet://shell.test.com/~home/' ), // // The following only work in PHP >= 5.3.7, due to a bug in parse_url which eats @@ -243,10 +243,10 @@ class LinkFilterTest extends MediaWikiLangTestCase { array( 'http://*.test.*' ), array( 'http://*test.com' ), array( 'https://*' ), - array( '*://test.com'), + array( '*://test.com' ), array( 'mailto:name:pass@t*est.com' ), - array( 'http://*:888/'), - array( '*http://'), + array( 'http://*:888/' ), + array( '*http://' ), array( 'test.com/*/index' ), array( 'test.com/dir/index?arg=*' ), ); diff --git a/tests/phpunit/includes/MovePageTest.php b/tests/phpunit/includes/MovePageTest.php index 9501e452ec..0ef2fa630f 100644 --- a/tests/phpunit/includes/MovePageTest.php +++ b/tests/phpunit/includes/MovePageTest.php @@ -57,7 +57,7 @@ class MovePageTest extends MediaWikiTestCase { WikiPage::factory( $oldTitle )->getRevision() ); $this->assertNotNull( - WikiPage::factory( $newTitle)->getRevision() + WikiPage::factory( $newTitle )->getRevision() ); } } diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index 6c6d95ee8a..7dddf77c05 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -244,36 +244,36 @@ document.write("\u003Cscript src=\"http://127.0.0.1:8080/w/load.php?debug=false\ 'test.foo' => new ResourceLoaderTestModule( array( 'script' => 'mw.test.foo( { a: true } );', 'styles' => '.mw-test-foo { content: "style"; }', - )), + ) ), 'test.bar' => new ResourceLoaderTestModule( array( 'script' => 'mw.test.bar( { a: true } );', 'styles' => '.mw-test-bar { content: "style"; }', - )), + ) ), 'test.baz' => new ResourceLoaderTestModule( array( 'script' => 'mw.test.baz( { a: true } );', 'styles' => '.mw-test-baz { content: "style"; }', - )), + ) ), 'test.quux' => new ResourceLoaderTestModule( array( 'script' => 'mw.test.baz( { token: 123 } );', 'styles' => '/* pref-animate=off */ .mw-icon { transition: none; }', 'group' => 'private', - )), + ) ), 'test.raw' => new ResourceLoaderTestModule( array( 'script' => 'mw.test.baz( { token: 123 } );', 'isRaw' => true, - )), + ) ), 'test.noscript' => new ResourceLoaderTestModule( array( 'styles' => '.mw-test-noscript { content: "style"; }', 'group' => 'noscript', - )), + ) ), 'test.group.bar' => new ResourceLoaderTestModule( array( 'styles' => '.mw-group-bar { content: "style"; }', 'group' => 'bar', - )), + ) ), 'test.group.foo' => new ResourceLoaderTestModule( array( 'styles' => '.mw-group-foo { content: "style"; }', 'group' => 'foo', - )), + ) ), ) ); $links = $method->invokeArgs( $out, $args ); // Strip comments to avoid variation due to wgDBname in WikiID and cache key @@ -286,19 +286,19 @@ document.write("\u003Cscript src=\"http://127.0.0.1:8080/w/load.php?debug=false\ * MessageBlobStore that doesn't do anything */ class NullMessageBlobStore extends MessageBlobStore { - public function get ( ResourceLoader $resourceLoader, $modules, $lang ) { + public function get( ResourceLoader $resourceLoader, $modules, $lang ) { return array(); } - public function insertMessageBlob ( $name, ResourceLoaderModule $module, $lang ) { + public function insertMessageBlob( $name, ResourceLoaderModule $module, $lang ) { return false; } - public function updateModule ( $name, ResourceLoaderModule $module, $lang ) { + public function updateModule( $name, ResourceLoaderModule $module, $lang ) { return; } - public function updateMessage ( $key ) { + public function updateMessage( $key ) { } public function clear() { } diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index c013f4fcdd..291ed31554 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -372,7 +372,7 @@ class StatusTest extends MediaWikiLangTestCase { ); $status = new Status(); - $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); + $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); $testCases['1MessageWarning'] = array( $status, "", @@ -449,7 +449,7 @@ class StatusTest extends MediaWikiLangTestCase { // ); $status = new Status(); - $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); + $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); $testCases['1MessageWarning'] = array( $status, array( 'foo', 'bar' ), diff --git a/tests/phpunit/includes/TitleTest.php b/tests/phpunit/includes/TitleTest.php index a8cffd1083..a2c6f23df4 100644 --- a/tests/phpunit/includes/TitleTest.php +++ b/tests/phpunit/includes/TitleTest.php @@ -145,7 +145,7 @@ class TitleTest extends MediaWikiTestCase { } ) ) - )); + ) ); } /** diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php index d98eec6a67..880572b4e7 100644 --- a/tests/phpunit/includes/api/ApiBlockTest.php +++ b/tests/phpunit/includes/api/ApiBlockTest.php @@ -68,7 +68,7 @@ class ApiBlockTest extends ApiTestCase { * @expectedException UsageException * @expectedExceptionMessage The token parameter must be set */ - public function testBlockingActionWithNoToken( ) { + public function testBlockingActionWithNoToken() { $this->doApiRequest( array( 'action' => 'block', diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php index 865f1c22da..fa528da4cd 100644 --- a/tests/phpunit/includes/api/ApiEditPageTest.php +++ b/tests/phpunit/includes/api/ApiEditPageTest.php @@ -218,7 +218,7 @@ class ApiEditPageTest extends ApiTestCase { 'section' => 'new', 'text' => 'test', 'summary' => 'header', - )); + ) ); $this->assertEquals( 'Success', $re['edit']['result'] ); // Check the page text is correct @@ -235,7 +235,7 @@ class ApiEditPageTest extends ApiTestCase { 'section' => 'new', 'text' => 'test', 'summary' => 'header', - )); + ) ); $this->assertEquals( 'Success', $re2['edit']['result'] ); $text = WikiPage::factory( Title::newFromText( $name ) ) diff --git a/tests/phpunit/includes/api/ApiUnblockTest.php b/tests/phpunit/includes/api/ApiUnblockTest.php index 2c2370a8eb..e9dff9fb24 100644 --- a/tests/phpunit/includes/api/ApiUnblockTest.php +++ b/tests/phpunit/includes/api/ApiUnblockTest.php @@ -16,7 +16,7 @@ class ApiUnblockTest extends ApiTestCase { /** * @expectedException UsageException */ - public function testWithNoToken( ) { + public function testWithNoToken() { $this->doApiRequest( array( 'action' => 'unblock', diff --git a/tests/phpunit/includes/config/HashConfigTest.php b/tests/phpunit/includes/config/HashConfigTest.php index 06973b092c..4aa3e30c9f 100644 --- a/tests/phpunit/includes/config/HashConfigTest.php +++ b/tests/phpunit/includes/config/HashConfigTest.php @@ -30,7 +30,7 @@ class HashConfigTest extends MediaWikiTestCase { public function testGet() { $conf = new HashConfig( array( 'one' => '1', - )); + ) ); $this->assertEquals( '1', $conf->get( 'one' ) ); $this->setExpectedException( 'ConfigException', 'HashConfig::get: undefined option' ); $conf->get( 'two' ); diff --git a/tests/phpunit/includes/content/JsonContentTest.php b/tests/phpunit/includes/content/JsonContentTest.php index cccfe7b1ba..8a9d2ab085 100644 --- a/tests/phpunit/includes/content/JsonContentTest.php +++ b/tests/phpunit/includes/content/JsonContentTest.php @@ -138,7 +138,7 @@ class JsonContentTest extends MediaWikiLangTestCase { '0"bar"' ), array( - (object)array( ''), + (object)array( '' ), '
0"' . '<script>alert("evil!")</script>"' . '
', diff --git a/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php b/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php index b4292a6023..42ea58e551 100644 --- a/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php +++ b/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php @@ -181,7 +181,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { array( 'Tables_in_' => 'view2' ), array( 'Tables_in_' => 'myview' ), false # no more rows - )); + ) ); return $db; } /** diff --git a/tests/phpunit/includes/diff/ArrayDiffFormatterTest.php b/tests/phpunit/includes/diff/ArrayDiffFormatterTest.php index 3bea9b31b3..a546bec17b 100644 --- a/tests/phpunit/includes/diff/ArrayDiffFormatterTest.php +++ b/tests/phpunit/includes/diff/ArrayDiffFormatterTest.php @@ -69,11 +69,11 @@ class ArrayDiffFormatterTest extends MediaWikiTestCase { $otherTestCases = array(); $otherTestCases[] = array( - $this->getMockDiff( array( $this->getMockDiffOp( 'add', array( ), array( 'a1' ) ) ) ), + $this->getMockDiff( array( $this->getMockDiffOp( 'add', array(), array( 'a1' ) ) ) ), array( array( 'action' => 'add', 'new' => 'a1', 'newline' => 1 ) ), ); $otherTestCases[] = array( - $this->getMockDiff( array( $this->getMockDiffOp( 'add', array( ), array( 'a1', 'a2' ) ) ) ), + $this->getMockDiff( array( $this->getMockDiffOp( 'add', array(), array( 'a1', 'a2' ) ) ) ), array( array( 'action' => 'add', 'new' => 'a1', 'newline' => 1 ), array( 'action' => 'add', 'new' => 'a2', 'newline' => 2 ), diff --git a/tests/phpunit/includes/exception/MWExceptionTest.php b/tests/phpunit/includes/exception/MWExceptionTest.php index ef0f2a9e2c..f11fda32b4 100644 --- a/tests/phpunit/includes/exception/MWExceptionTest.php +++ b/tests/phpunit/includes/exception/MWExceptionTest.php @@ -178,7 +178,7 @@ class MWExceptionTest extends MediaWikiTestCase { $this->setMwGlobals( array( 'wgLogExceptionBacktrace' => true ) ); $json = json_decode( - MWExceptionHandler::jsonSerializeException( new $exClass()) + MWExceptionHandler::jsonSerializeException( new $exClass() ) ); $this->assertObjectHasAttribute( $key, $json, "JSON serialized exception is missing key '$key'" diff --git a/tests/phpunit/includes/libs/ArrayUtilsTest.php b/tests/phpunit/includes/libs/ArrayUtilsTest.php index a91cc950d6..32b150c7e6 100644 --- a/tests/phpunit/includes/libs/ArrayUtilsTest.php +++ b/tests/phpunit/includes/libs/ArrayUtilsTest.php @@ -212,7 +212,7 @@ class ArrayUtilsTest extends PHPUnit_Framework_TestCase { array(), array( 1 => 1 ), array( 1 ), - array( 1 => 1), + array( 1 => 1 ), ), array( array(), diff --git a/tests/phpunit/includes/libs/XhprofTest.php b/tests/phpunit/includes/libs/XhprofTest.php index 2440fc08ee..77b188cf73 100644 --- a/tests/phpunit/includes/libs/XhprofTest.php +++ b/tests/phpunit/includes/libs/XhprofTest.php @@ -255,43 +255,43 @@ class XhprofTest extends PHPUnit_Framework_TestCase { */ protected function getXhprofFixture( array $opts = array() ) { $xhprof = new Xhprof( $opts ); - $xhprof->loadRawData( array ( - 'foo==>bar' => array ( + $xhprof->loadRawData( array( + 'foo==>bar' => array( 'ct' => 2, 'wt' => 57, 'cpu' => 92, 'mu' => 1896, 'pmu' => 0, ), - 'foo==>strlen' => array ( + 'foo==>strlen' => array( 'ct' => 2, 'wt' => 21, 'cpu' => 141, 'mu' => 752, 'pmu' => 0, ), - 'bar==>bar@1' => array ( + 'bar==>bar@1' => array( 'ct' => 1, 'wt' => 18, 'cpu' => 19, 'mu' => 752, 'pmu' => 0, ), - 'main()==>foo' => array ( + 'main()==>foo' => array( 'ct' => 1, 'wt' => 304, 'cpu' => 307, 'mu' => 4008, 'pmu' => 0, ), - 'main()==>xhprof_disable' => array ( + 'main()==>xhprof_disable' => array( 'ct' => 1, 'wt' => 8, 'cpu' => 10, 'mu' => 768, 'pmu' => 392, ), - 'main()' => array ( + 'main()' => array( 'ct' => 1, 'wt' => 353, 'cpu' => 351, @@ -311,7 +311,7 @@ class XhprofTest extends PHPUnit_Framework_TestCase { */ protected function assertArrayStructure( $struct, $actual, $label = null ) { $this->assertInternalType( 'array', $actual, $label ); - $this->assertCount( count($struct), $actual, $label ); + $this->assertCount( count( $struct ), $actual, $label ); foreach ( $struct as $key => $type ) { $this->assertArrayHasKey( $key, $actual ); $this->assertInternalType( $type, $actual[$key] ); diff --git a/tests/phpunit/includes/objectcache/WANObjectCacheTest.php b/tests/phpunit/includes/objectcache/WANObjectCacheTest.php index 284a67df60..10dee83cee 100644 --- a/tests/phpunit/includes/objectcache/WANObjectCacheTest.php +++ b/tests/phpunit/includes/objectcache/WANObjectCacheTest.php @@ -68,7 +68,7 @@ class WANObjectCacheTest extends MediaWikiTestCase { $key = wfRandomString(); for ( $i=0; $i<3; ++$i ) { $value = wfRandomString(); - $this->cache->set($key, $value, 3); + $this->cache->set( $key, $value, 3 ); $this->assertEquals( $this->cache->get( $key ), $value ); } diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php index 358d2a131c..9d97b28270 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php @@ -158,7 +158,7 @@ class ResourceLoaderFileModuleTest extends ResourceLoaderTestCase { * @covers ResourceLoaderFileModule::getStyles * @covers ResourceLoaderFileModule::getStyleFiles */ - public function testMixedCssAnnotations( ) { + public function testMixedCssAnnotations() { $basePath = __DIR__ . '/../../data/css'; $testModule = new ResourceLoaderFileModule( array( 'localBasePath' => $basePath, diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php index ca7307ec9a..cc20e7facf 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php @@ -16,7 +16,7 @@ class ResourceLoaderTest extends ResourceLoaderTestCase { }, ), 'wgResourceLoaderLESSImportPaths' => array( - dirname( dirname( __DIR__ ) ) . '/data/less/common', + dirname( dirname( __DIR__ ) ) . '/data/less/common', ), 'wgResourceLoaderLESSVars' => array( 'foo' => '2px', diff --git a/tests/phpunit/includes/title/ForeignTitleTest.php b/tests/phpunit/includes/title/ForeignTitleTest.php index 599d2a33a4..10b7e28f25 100644 --- a/tests/phpunit/includes/title/ForeignTitleTest.php +++ b/tests/phpunit/includes/title/ForeignTitleTest.php @@ -59,7 +59,7 @@ class ForeignTitleTest extends MediaWikiTestCase { $this->assertEquals( $expectedText, $title->getText() ); } - public function testUnknownNamespaceCheck( ) { + public function testUnknownNamespaceCheck() { $title = new ForeignTitle( null, 'this', 'that' ); $this->assertEquals( false, $title->isNamespaceIdKnown() ); @@ -67,7 +67,7 @@ class ForeignTitleTest extends MediaWikiTestCase { $this->assertEquals( 'that', $title->getText() ); } - public function testUnknownNamespaceError( ) { + public function testUnknownNamespaceError() { $this->setExpectedException( 'MWException' ); $title = new ForeignTitle( null, 'this', 'that' ); $title->getNamespaceId(); diff --git a/tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php b/tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php index cd0d0b1c40..1e5f9d0150 100644 --- a/tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php +++ b/tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php @@ -158,7 +158,7 @@ class MediaWikiPageLinkRendererTest extends MediaWikiTestCase { function ( TitleValue $title ) { return str_replace( '_', ' ', "$title" ); } - )); + ) ); $renderer = new MediaWikiPageLinkRenderer( $formatter, '/' ); $actual = $renderer->renderWikitextLink( $title, $text ); diff --git a/tests/phpunit/languages/classes/LanguageArqTest.php b/tests/phpunit/languages/classes/LanguageArqTest.php index 3fa56d7819..71e0583840 100644 --- a/tests/phpunit/languages/classes/LanguageArqTest.php +++ b/tests/phpunit/languages/classes/LanguageArqTest.php @@ -18,7 +18,7 @@ class LanguageArqTest extends LanguageClassesTestCase { public static function provideNumber() { return array( - array( '1.234.567', '1234567'), + array( '1.234.567', '1234567' ), array( '-12,89', -12.89 ), ); } diff --git a/tests/phpunit/maintenance/backupTextPassTest.php b/tests/phpunit/maintenance/backupTextPassTest.php index 7fc9997610..6c4839e009 100644 --- a/tests/phpunit/maintenance/backupTextPassTest.php +++ b/tests/phpunit/maintenance/backupTextPassTest.php @@ -633,7 +633,7 @@ class TextPassDumperDatabaselessTest extends MediaWikiLangTestCase { */ function testBufferSizeSetting( $expected, $size, $msg ) { $dumper = new TextPassDumperAccessor( array( "--buffersize=" . $size ) ); - $this->assertEquals( $expected, $dumper->getBufferSize(), $msg); + $this->assertEquals( $expected, $dumper->getBufferSize(), $msg ); } /** diff --git a/tests/testHelpers.inc b/tests/testHelpers.inc index 6d3ac2f5cb..16f458bfe6 100644 --- a/tests/testHelpers.inc +++ b/tests/testHelpers.inc @@ -695,7 +695,7 @@ class DelayedParserTest { * @throws MWException */ public function unleash( &$parserTest ) { - if ( !( $parserTest instanceof ParserTest || $parserTest instanceof NewParserTest ) ) { + if ( !( $parserTest instanceof ParserTest || $parserTest instanceof NewParserTest ) ) { throw new MWException( __METHOD__ . " must be passed an instance of ParserTest or " . "NewParserTest classes\n" ); } diff --git a/thumb.php b/thumb.php index 40f375480e..c77cddcd4f 100644 --- a/thumb.php +++ b/thumb.php @@ -235,7 +235,7 @@ function wfStreamThumb( array $params ) { $imsUnix = strtotime( $imsString ); MediaWiki\restoreWarnings(); if ( wfTimestamp( TS_UNIX, $img->getTimestamp() ) <= $imsUnix ) { - HttpStatus::header( 304 ); + HttpStatus::header( 304 ); return; } } -- 2.20.1