From f153998317bba5803fdf16749b79cfefaae59620 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Tue, 19 Nov 2013 19:03:54 +0100 Subject: [PATCH] Fixed spacing - Removed double spaces - Added space after if/switch/foreach - Removed space on elseif - Added space around parentheses - Added newline at end of file - Removed space before semicolon at end of line Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d --- includes/Action.php | 2 +- includes/GlobalFunctions.php | 2 +- includes/HTMLForm.php | 2 +- includes/Title.php | 2 +- includes/api/ApiQuery.php | 2 +- includes/db/DatabaseMysqlBase.php | 6 ++--- includes/db/DatabaseMysqli.php | 2 +- includes/filerepo/file/LocalFile.php | 6 ++--- includes/installer/DatabaseUpdater.php | 4 ++-- includes/media/FormatMetadata.php | 12 +++++----- includes/parser/ParserOutput.php | 2 +- .../ResourceLoaderFileModule.php | 2 +- includes/specials/SpecialListfiles.php | 2 +- includes/upload/UploadFromChunks.php | 2 +- maintenance/benchmarks/bench_wfIsWindows.php | 2 +- maintenance/mergeMessageFileList.php | 2 +- .../archives/patch_16_17_schema_changes.sql | 2 +- maintenance/oracle/tables.sql | 2 +- maintenance/purgeChangedFiles.php | 4 ++-- maintenance/update.php | 2 +- tests/phpunit/data/db/sqlite/tables-1.13.sql | 8 +++---- tests/phpunit/includes/ExceptionTest.php | 8 +++---- tests/phpunit/includes/FallbackTest.php | 3 +-- .../includes/MWExceptionHandlerTest.php | 8 +++---- tests/phpunit/includes/StatusTest.php | 22 +++++++++---------- tests/phpunit/includes/UserMailerTest.php | 2 +- tests/phpunit/includes/XmlJsTest.php | 2 +- .../phpunit/includes/api/ApiEditPageTest.php | 2 +- tests/phpunit/includes/api/ApiOptionsTest.php | 2 +- tests/phpunit/includes/api/ApiTestContext.php | 2 +- tests/phpunit/includes/api/MockApi.php | 2 +- tests/phpunit/includes/api/UserWrapper.php | 2 +- .../includes/db/DatabaseMysqlBaseTest.php | 12 +++++----- tests/phpunit/includes/db/DatabaseTest.php | 2 +- .../includes/diff/DifferenceEngineTest.php | 6 ++--- .../includes/media/FakeDimensionFile.php | 2 +- .../includes/media/FormatMetadataTest.php | 16 +++++++------- tests/phpunit/includes/parser/TidyTest.php | 2 +- tests/phpunit/structure/AutoLoaderTest.php | 2 +- .../mediawiki/mediawiki.jqueryMsg.test.js | 2 +- 40 files changed, 84 insertions(+), 85 deletions(-) diff --git a/includes/Action.php b/includes/Action.php index 4b6e44689c..72be46f0bb 100644 --- a/includes/Action.php +++ b/includes/Action.php @@ -167,7 +167,7 @@ abstract class Action { final public function getContext() { if ( $this->context instanceof IContextSource ) { return $this->context; - } else if ( $this->page instanceof Article ) { + } elseif ( $this->page instanceof Article ) { // NOTE: $this->page can be a WikiPage, which does not have a context. wfDebug( __METHOD__ . ': no context known, falling back to Article\'s context.' ); return $this->page->getContext(); diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 688300aaee..57877a2b0f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -3810,7 +3810,7 @@ function wfGetNull() { * @param string|bool $cluster Cluster name accepted by LBFactory. Default: false. */ function wfWaitForSlaves( $maxLag = false, $wiki = false, $cluster = false ) { - if( $cluster !== false ) { + if ( $cluster !== false ) { $lb = wfGetLBFactory()->getExternalLB( $cluster ); } else { $lb = wfGetLB( $wiki ); diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index d260862c0c..b60146a63a 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -1034,7 +1034,7 @@ class HTMLForm extends ContextSource { $subsectionHtml = ''; $hasLabel = false; - switch( $displayFormat ) { + switch ( $displayFormat ) { case 'table': $getFieldHtmlMethod = 'getTableRow'; break; diff --git a/includes/Title.php b/includes/Title.php index 4b8a141c55..c726e9d74b 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4830,7 +4830,7 @@ class Title { $langObj = wfGetLangObj( $contentHandler->getPageLanguage( $this ) ); $this->mPageLanguage = array( $langObj->getCode(), $wgLanguageCode ); } else { - $langObj = wfGetLangObj( $this->mPageLanguage[0] ); + $langObj = wfGetLangObj( $this->mPageLanguage[0] ); } wfProfileOut( __METHOD__ ); return $langObj; diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index 79a3b051b1..cec1ca86f9 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -714,7 +714,7 @@ class ApiQuery extends ApiBase { 'meta' => 'Which metadata to get about the site. Module help is available below', 'indexpageids' => 'Include an additional pageids section listing all returned page IDs', 'export' => 'Export the current revisions of all given or generated pages', - 'exportnowrap' => 'Return the export XML without wrapping it in an '. + 'exportnowrap' => 'Return the export XML without wrapping it in an ' . 'XML result (same format as Special:Export). Can only be used with export', 'iwurl' => 'Whether to get the full URL if the title is an interwiki link', 'continue' => array( diff --git a/includes/db/DatabaseMysqlBase.php b/includes/db/DatabaseMysqlBase.php index 5be460f429..6a3ebcb6cb 100644 --- a/includes/db/DatabaseMysqlBase.php +++ b/includes/db/DatabaseMysqlBase.php @@ -480,7 +480,7 @@ abstract class DatabaseMysqlBase extends DatabaseBase { public function addIdentifierQuotes( $s ) { // Characters in the range \u0001-\uFFFF are valid in a quoted identifier // Remove NUL bytes and escape backticks by doubling - return '`' . str_replace( array( "\0", '`' ), array( '', '``' ), $s ) . '`'; + return '`' . str_replace( array( "\0", '`' ), array( '', '``' ), $s ) . '`'; } /** @@ -1024,12 +1024,12 @@ abstract class DatabaseMysqlBase extends DatabaseBase { // Query for the VIEWS $result = $this->query( 'SHOW FULL TABLES WHERE TABLE_TYPE = "VIEW"' ); $this->allViews = array(); - while ( ($row = $this->fetchRow($result)) !== false ) { + while ( ( $row = $this->fetchRow( $result ) ) !== false ) { array_push( $this->allViews, $row[$propertyName] ); } } - if ( is_null($prefix) || $prefix === '' ) { + if ( is_null( $prefix ) || $prefix === '' ) { return $this->allViews; } diff --git a/includes/db/DatabaseMysqli.php b/includes/db/DatabaseMysqli.php index 5b2e11d960..a47c8042fd 100644 --- a/includes/db/DatabaseMysqli.php +++ b/includes/db/DatabaseMysqli.php @@ -187,7 +187,7 @@ class DatabaseMysqli extends DatabaseMysqlBase { } protected function mysqlError( $conn = null ) { - if ($conn === null) { + if ( $conn === null ) { return mysqli_connect_error(); } else { return $conn->error; diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index fe769be28c..b609f4328e 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -539,7 +539,7 @@ class LocalFile extends File { 'img_media_type' => $this->media_type, 'img_major_mime' => $major, 'img_minor_mime' => $minor, - 'img_metadata' => $dbw->encodeBlob($this->metadata), + 'img_metadata' => $dbw->encodeBlob( $this->metadata ), 'img_sha1' => $this->sha1, ), array( 'img_name' => $this->getName() ), @@ -1225,7 +1225,7 @@ class LocalFile extends File { 'img_description' => $comment, 'img_user' => $user->getId(), 'img_user_text' => $user->getName(), - 'img_metadata' => $dbw->encodeBlob($this->metadata), + 'img_metadata' => $dbw->encodeBlob( $this->metadata ), 'img_sha1' => $this->sha1 ), __METHOD__, @@ -1276,7 +1276,7 @@ class LocalFile extends File { 'img_description' => $comment, 'img_user' => $user->getId(), 'img_user_text' => $user->getName(), - 'img_metadata' => $dbw->encodeBlob($this->metadata), + 'img_metadata' => $dbw->encodeBlob( $this->metadata ), 'img_sha1' => $this->sha1 ), array( 'img_name' => $this->getName() ), diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 41cbf5051a..3f2e2cb8f8 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -1045,7 +1045,7 @@ abstract class DatabaseUpdater { protected function disableContentHandlerUseDB() { global $wgContentHandlerUseDB; - if( $wgContentHandlerUseDB ) { + if ( $wgContentHandlerUseDB ) { $this->output( "Turning off Content Handler DB fields for this part of upgrade.\n" ); $this->holdContentHandlerUseDB = $wgContentHandlerUseDB; $wgContentHandlerUseDB = false; @@ -1058,7 +1058,7 @@ abstract class DatabaseUpdater { protected function enableContentHandlerUseDB() { global $wgContentHandlerUseDB; - if( $this->holdContentHandlerUseDB ) { + if ( $this->holdContentHandlerUseDB ) { $this->output( "Content Handler DB fields should be usable now.\n" ); $wgContentHandlerUseDB = $this->holdContentHandlerUseDB; } diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index 91c4c9a063..1b1841c3a3 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -977,7 +977,7 @@ class FormatMetadata extends ContextSource { $defaultItem = $vals['x-default']; unset( $vals['x-default'] ); } - foreach( $priorityLanguages as $pLang ) { + foreach ( $priorityLanguages as $pLang ) { if ( isset( $vals[$pLang] ) ) { $isDefault = false; if ( $vals[$pLang] === $defaultItem ) { @@ -1506,7 +1506,7 @@ class FormatMetadata extends ContextSource { // This is an API-specific function so it would be cleaner to call it from // outside fetchExtendedMetadata, but this way we don't need to redo the // computation on a cache hit. - $this->sanitizeArrayForXml($extendedMetadata); + $this->sanitizeArrayForXml( $extendedMetadata ); $valueToCache = array( 'data' => $extendedMetadata, 'timestamp' => wfTimestampNow() ); $wgMemc->set( $cacheKey, $valueToCache, $maxCacheTime ); } @@ -1628,7 +1628,7 @@ class FormatMetadata extends ContextSource { // choose the language best matching user or site settings $priorityLanguages = $this->getPriorityLanguages(); - foreach( $priorityLanguages as $lang ) { + foreach ( $priorityLanguages as $lang ) { if ( isset( $value[$lang] ) ) { return $value[$lang]; } @@ -1640,9 +1640,9 @@ class FormatMetadata extends ContextSource { } // otherwise just return any one language - unset($value['_type']); - if (!empty($value)) { - return reset($value); + unset( $value['_type'] ); + if ( !empty( $value ) ) { + return reset( $value ); } // this should not happen; signal error diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 502f0fd186..29502270f4 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -83,7 +83,7 @@ class ParserOutput extends CacheTime { $text = str_replace( array( Parser::TOC_START, Parser::TOC_END ), '', $text ); } else { $text = preg_replace( - '#'. preg_quote( Parser::TOC_START ) . '.*?' . preg_quote( Parser::TOC_END ) . '#s', + '#' . preg_quote( Parser::TOC_START ) . '.*?' . preg_quote( Parser::TOC_END ) . '#s', '', $text ); diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index 7b85001878..818399953c 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -585,7 +585,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { */ public function getAllStyleFiles() { $files = array(); - foreach( (array)$this->styles as $key => $value ) { + foreach ( (array)$this->styles as $key => $value ) { if ( is_array( $value ) ) { $path = $key; } else { diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index dff1cf70de..7484995f31 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -240,7 +240,7 @@ class ImageListPager extends TablePager { } $field = $prefix . substr( $field, 3 ) . ' AS ' . $field; } - $fields[array_search('top', $fields)] = "'no' AS top"; + $fields[array_search( 'top', $fields )] = "'no' AS top"; } else { if ( $this->mShowAll ) { $fields[array_search( 'top', $fields )] = "'yes' AS top"; diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index 091bd78f99..b572499783 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -127,7 +127,7 @@ class UploadFromChunks extends UploadFromFile { // Get a 0-byte temp file to perform the concatenation at $tmpFile = TempFSFile::factory( 'chunkedupload_', $ext ); $tmpPath = false; // fail in concatenate() - if( $tmpFile ) { + if ( $tmpFile ) { // keep alive with $this $tmpPath = $tmpFile->bind( $this )->getPath(); } diff --git a/maintenance/benchmarks/bench_wfIsWindows.php b/maintenance/benchmarks/bench_wfIsWindows.php index 1cd2016ba9..76cea2cdad 100644 --- a/maintenance/benchmarks/bench_wfIsWindows.php +++ b/maintenance/benchmarks/bench_wfIsWindows.php @@ -47,7 +47,7 @@ class bench_wfIsWindows extends Benchmarker { } static function is_win() { - return substr( php_uname(), 0, 7 ) == 'Windows' ; + return substr( php_uname(), 0, 7 ) == 'Windows'; } // bench function 1 diff --git a/maintenance/mergeMessageFileList.php b/maintenance/mergeMessageFileList.php index e91833777d..5bf04c6961 100644 --- a/maintenance/mergeMessageFileList.php +++ b/maintenance/mergeMessageFileList.php @@ -148,7 +148,7 @@ foreach ( $mmfl['setupFiles'] as $fileName ) { fwrite( STDERR, "Loading data from $fileName\n" ); } // Include the extension to update $wgExtensionMessagesFiles - if ( !( include_once( $fileName ) ) ) { + if ( !( include_once $fileName ) ) { fwrite( STDERR, "Unable to read $fileName\n" ); exit( 1 ); } diff --git a/maintenance/oracle/archives/patch_16_17_schema_changes.sql b/maintenance/oracle/archives/patch_16_17_schema_changes.sql index 64c284811b..cd99f7cc07 100644 --- a/maintenance/oracle/archives/patch_16_17_schema_changes.sql +++ b/maintenance/oracle/archives/patch_16_17_schema_changes.sql @@ -67,7 +67,7 @@ CREATE TABLE &mw_prefix.msg_resource ( mr_lang varchar2(32) NOT NULL, mr_blob BLOB NOT NULL, mr_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL -) ; +); CREATE UNIQUE INDEX &mw_prefix.msg_resource_u01 ON &mw_prefix.msg_resource (mr_resource, mr_lang); ALTER TABLE &mw_prefix.oldimage MODIFY oi_name DEFAULT 0; diff --git a/maintenance/oracle/tables.sql b/maintenance/oracle/tables.sql index 607d7b94ef..2395bc53a6 100644 --- a/maintenance/oracle/tables.sql +++ b/maintenance/oracle/tables.sql @@ -663,7 +663,7 @@ CREATE TABLE &mw_prefix.msg_resource ( mr_lang varchar2(32) NOT NULL, mr_blob BLOB NOT NULL, mr_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL -) ; +); CREATE UNIQUE INDEX &mw_prefix.msg_resource_u01 ON &mw_prefix.msg_resource (mr_resource, mr_lang); CREATE TABLE &mw_prefix.msg_resource_links ( diff --git a/maintenance/purgeChangedFiles.php b/maintenance/purgeChangedFiles.php index c21301b763..91c36f28d1 100644 --- a/maintenance/purgeChangedFiles.php +++ b/maintenance/purgeChangedFiles.php @@ -121,7 +121,7 @@ class PurgeChangedFiles extends Maintenance { $this->mOptions['verbose'] = 1; } - $this->verbose( 'Purging files that were: ' . implode( ', ', $typeList ) . "\n"); + $this->verbose( 'Purging files that were: ' . implode( ', ', $typeList ) . "\n" ); foreach ( $typeList as $type ) { $this->verbose( "Checking for {$type} files...\n" ); $this->purgeFromLogType( $type ); @@ -186,7 +186,7 @@ class PurgeChangedFiles extends Maintenance { // Purge items from fileachive table (rows are likely here) $this->purgeFromArchiveTable( $repo, $file ); - } else if ( $logType === 'move' ) { + } elseif ( $logType === 'move' ) { // Purge the target file as well $params = unserialize( $row->log_params ); diff --git a/maintenance/update.php b/maintenance/update.php index e39661a1de..6b08480add 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -169,7 +169,7 @@ class UpdateMediaWiki extends Maintenance { $time2 = new MWTimestamp(); $this->output( "\nDone.\n" ); - $this->output( "\nThe job took ". $time2->diff( $time1 )->format( "%i:%S" ). "\n" ); + $this->output( "\nThe job took " . $time2->diff( $time1 )->format( "%i:%S" ) . "\n" ); } function afterFinalSetup() { diff --git a/tests/phpunit/data/db/sqlite/tables-1.13.sql b/tests/phpunit/data/db/sqlite/tables-1.13.sql index 66847ab179..2efb7a0ea5 100644 --- a/tests/phpunit/data/db/sqlite/tables-1.13.sql +++ b/tests/phpunit/data/db/sqlite/tables-1.13.sql @@ -50,12 +50,12 @@ CREATE TABLE /*$wgDBprefix*/revision ( rev_minor_edit tinyint default '0', rev_deleted tinyint default '0', rev_len int, - rev_parent_id INTEGER default NULL) /*$wgDBTableOptions*/ ; + rev_parent_id INTEGER default NULL) /*$wgDBTableOptions*/; CREATE TABLE /*$wgDBprefix*/text ( old_id INTEGER PRIMARY KEY AUTOINCREMENT, old_text mediumblob , - old_flags tinyblob ) /*$wgDBTableOptions*/ ; + old_flags tinyblob ) /*$wgDBTableOptions*/; CREATE TABLE /*$wgDBprefix*/archive ( ar_namespace INTEGER default '0', @@ -124,7 +124,7 @@ CREATE TABLE /*$wgDBprefix*/site_stats ( CREATE TABLE /*$wgDBprefix*/hitcounter ( hc_id INTEGER -) ; +); CREATE TABLE /*$wgDBprefix*/ipblocks ( ipb_id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -245,7 +245,7 @@ CREATE TABLE /*$wgDBprefix*/math ( CREATE TABLE /*$wgDBprefix*/searchindex ( si_page INTEGER , si_title varchar(255) default '', - si_text mediumtext ) ; + si_text mediumtext ); CREATE TABLE /*$wgDBprefix*/interwiki ( iw_prefix varchar(32) , diff --git a/tests/phpunit/includes/ExceptionTest.php b/tests/phpunit/includes/ExceptionTest.php index 9e7604546f..63fff6e1e2 100644 --- a/tests/phpunit/includes/ExceptionTest.php +++ b/tests/phpunit/includes/ExceptionTest.php @@ -49,7 +49,7 @@ class ExceptionTest extends MediaWikiTestCase { * @param $key String Name of the key to validate in the serialized JSON * @dataProvider provideJsonSerializedKeys */ - function testJsonserializeexceptionKeys($expectedKeyType, $exClass, $key) { + function testJsonserializeexceptionKeys( $expectedKeyType, $exClass, $key ) { # Make sure we log a backtrace: $this->setMwGlobals( array( 'wgLogExceptionBacktrace' => true ) ); @@ -61,7 +61,7 @@ class ExceptionTest extends MediaWikiTestCase { "JSON serialized exception is missing key '$key'" ); $this->assertInternalType( $expectedKeyType, $json->$key, - "JSON serialized key '$key' has type " . gettype($json->$key) + "JSON serialized key '$key' has type " . gettype( $json->$key ) . " (expected: $expectedKeyType)." ); } @@ -71,7 +71,7 @@ class ExceptionTest extends MediaWikiTestCase { */ function provideJsonSerializedKeys() { $testCases = array(); - foreach( array( 'Exception', 'MWException' ) as $exClass ) { + foreach ( array( 'Exception', 'MWException' ) as $exClass ) { $exTests = array( array( 'string', $exClass, 'id' ), array( 'string', $exClass, 'file' ), @@ -81,7 +81,7 @@ class ExceptionTest extends MediaWikiTestCase { # Backtrace only enabled with wgLogExceptionBacktrace = true array( 'array', $exClass, 'backtrace' ), ); - $testCases = array_merge($testCases, $exTests); + $testCases = array_merge( $testCases, $exTests ); } return $testCases; } diff --git a/tests/phpunit/includes/FallbackTest.php b/tests/phpunit/includes/FallbackTest.php index f408f47164..910b766f7c 100644 --- a/tests/phpunit/includes/FallbackTest.php +++ b/tests/phpunit/includes/FallbackTest.php @@ -69,5 +69,4 @@ class FallbackTest extends MediaWikiTestCase { ); } } - -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/MWExceptionHandlerTest.php b/tests/phpunit/includes/MWExceptionHandlerTest.php index aebd65f8ce..dd76e3bc9e 100644 --- a/tests/phpunit/includes/MWExceptionHandlerTest.php +++ b/tests/phpunit/includes/MWExceptionHandlerTest.php @@ -19,7 +19,7 @@ class MWExceptionHandlerTest extends MediaWikiTestCase { $array = array( 'a', 'b' ); $object = new StdClass(); self::helperThrowAnException( $array, $object, $refvar ); - } catch (Exception $e) { + } catch ( Exception $e ) { } # Make sure our strack trace contains an array and an object passed to @@ -37,7 +37,7 @@ class MWExceptionHandlerTest extends MediaWikiTestCase { $hasArray = $hasArray || is_array( $arg ); } - if( $hasObject && $hasArray ) { + if ( $hasObject && $hasArray ) { break; } } @@ -55,8 +55,8 @@ class MWExceptionHandlerTest extends MediaWikiTestCase { continue; } foreach ( $frame['args'] as $arg ) { - $this->assertNotInternalType( 'array', $arg); - $this->assertNotInternalType( 'object', $arg); + $this->assertNotInternalType( 'array', $arg ); + $this->assertNotInternalType( 'object', $arg ); } } diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index 0a7cc0438f..9424d976a3 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -5,7 +5,7 @@ */ class StatusTest extends MediaWikiTestCase { - public function testCanConstruct(){ + public function testCanConstruct() { new Status(); $this->assertTrue( true ); } @@ -17,14 +17,14 @@ class StatusTest extends MediaWikiTestCase { * @covers Status::isGood * @covers Status::isOK */ - public function testNewGood( $value = null ){ + public function testNewGood( $value = null ) { $status = Status::newGood( $value ); $this->assertTrue( $status->isGood() ); $this->assertTrue( $status->isOK() ); $this->assertEquals( $value, $status->getValue() ); } - public static function provideValues(){ + public static function provideValues() { return array( array(), array( 'foo' ), @@ -96,13 +96,13 @@ class StatusTest extends MediaWikiTestCase { $status = new Status(); $messages = $this->getMockMessages( $mockDetails ); - foreach( $messages as $message ){ + foreach ( $messages as $message ) { $status->warning( $message ); } $warnings = $status->getWarningsArray(); $this->assertEquals( count( $messages ), count( $warnings ) ); - foreach( $messages as $key => $message ) { + foreach ( $messages as $key => $message ) { $expectedArray = array_merge( array( $message->getKey() ), $message->getParams() ); $this->assertEquals( $warnings[$key], $expectedArray ); } @@ -117,13 +117,13 @@ class StatusTest extends MediaWikiTestCase { $status = new Status(); $messages = $this->getMockMessages( $mockDetails ); - foreach( $messages as $message ){ + foreach ( $messages as $message ) { $status->error( $message ); } $errors = $status->getErrorsArray(); $this->assertEquals( count( $messages ), count( $errors ) ); - foreach( $messages as $key => $message ) { + foreach ( $messages as $key => $message ) { $expectedArray = array_merge( array( $message->getKey() ), $message->getParams() ); $this->assertEquals( $errors[$key], $expectedArray ); } @@ -146,15 +146,15 @@ class StatusTest extends MediaWikiTestCase { * @param array $messageDetails eg. array( 'KEY' => array(/PARAMS/) ) * @return Message[] */ - protected function getMockMessages( $messageDetails ){ + protected function getMockMessages( $messageDetails ) { $messages = array(); - foreach( $messageDetails as $key => $paramsArray ){ + foreach ( $messageDetails as $key => $paramsArray ) { $messages[] = $this->getMockMessage( $key, $paramsArray ); } return $messages; } - public static function provideMockMessageDetails(){ + public static function provideMockMessageDetails() { return array( array( array( 'key1' => array( 'foo' => 'bar' ) ) ), array( array( 'key1' => array( 'foo' => 'bar' ), 'key2' => array( 'foo2' => 'bar2' ) ) ), @@ -165,7 +165,7 @@ class StatusTest extends MediaWikiTestCase { * @covers Status::merge * @todo test merge with $overwriteValue true */ - public function testMerge(){ + public function testMerge() { $status1 = new Status(); $status2 = new Status(); $message1 = $this->getMockMessage( 'warn1' ); diff --git a/tests/phpunit/includes/UserMailerTest.php b/tests/phpunit/includes/UserMailerTest.php index 278edfaa9a..dca8aeb997 100644 --- a/tests/phpunit/includes/UserMailerTest.php +++ b/tests/phpunit/includes/UserMailerTest.php @@ -11,4 +11,4 @@ class UserMailerTest extends MediaWikiLangTestCase { UserMailer::quotedPrintable( "\xc4\x88u legebla?", "UTF-8" ) ); } -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/XmlJsTest.php b/tests/phpunit/includes/XmlJsTest.php index 161468e29e..907ce79f93 100644 --- a/tests/phpunit/includes/XmlJsTest.php +++ b/tests/phpunit/includes/XmlJsTest.php @@ -14,7 +14,7 @@ class XmlJs extends MediaWikiTestCase { $this->assertEquals( $value, $obj->value ); } - public function provideConstruction(){ + public function provideConstruction() { return array( array( null ), array( '' ), diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php index 7521dcf743..8fe08e10b6 100644 --- a/tests/phpunit/includes/api/ApiEditPageTest.php +++ b/tests/phpunit/includes/api/ApiEditPageTest.php @@ -212,7 +212,7 @@ class ApiEditPageTest extends ApiTestCase { 'text' => "==section 1==\nnew content 1", ) ); $this->assertEquals( 'Success', $re['edit']['result'] ); - $newtext = WikiPage::factory( Title::newFromText( $name) )->getContent( Revision::RAW )->getNativeData(); + $newtext = WikiPage::factory( Title::newFromText( $name ) )->getContent( Revision::RAW )->getNativeData(); $this->assertEquals( $newtext, "==section 1==\nnew content 1\n\n==section 2==\ncontent2" ); // Test that we raise a 'nosuchsection' error diff --git a/tests/phpunit/includes/api/ApiOptionsTest.php b/tests/phpunit/includes/api/ApiOptionsTest.php index 3168f323c0..6e5edbf6e4 100644 --- a/tests/phpunit/includes/api/ApiOptionsTest.php +++ b/tests/phpunit/includes/api/ApiOptionsTest.php @@ -10,7 +10,7 @@ class ApiOptionsTest extends MediaWikiLangTestCase { /** @var PHPUnit_Framework_MockObject_MockObject */ - private $mUserMock ; + private $mUserMock; /** @var ApiOptions */ private $mTested; private $mSession; diff --git a/tests/phpunit/includes/api/ApiTestContext.php b/tests/phpunit/includes/api/ApiTestContext.php index 43637c2344..80d7ea647a 100644 --- a/tests/phpunit/includes/api/ApiTestContext.php +++ b/tests/phpunit/includes/api/ApiTestContext.php @@ -18,4 +18,4 @@ class ApiTestContext extends RequestContext { return $context; } -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/api/MockApi.php b/tests/phpunit/includes/api/MockApi.php index 3686048cc0..d94aa2cda5 100644 --- a/tests/phpunit/includes/api/MockApi.php +++ b/tests/phpunit/includes/api/MockApi.php @@ -17,4 +17,4 @@ class MockApi extends ApiBase { 'sessionkey' => null, ); } -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/api/UserWrapper.php b/tests/phpunit/includes/api/UserWrapper.php index 3262e6ccbc..f8da0ff4e3 100644 --- a/tests/phpunit/includes/api/UserWrapper.php +++ b/tests/phpunit/includes/api/UserWrapper.php @@ -22,4 +22,4 @@ class UserWrapper { } $this->user->saveSettings(); } -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php b/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php index 2162a02a18..58f20142fc 100644 --- a/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php +++ b/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php @@ -65,7 +65,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { public function testAddIdentifierQuotes( $expected, $in ) { $db = new FakeDatabaseMysqlBase(); $quoted = $db->addIdentifierQuotes( $in ); - $this->assertEquals($expected, $quoted); + $this->assertEquals( $expected, $quoted ); } @@ -121,7 +121,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { ); } - private static function createUnicodeString($str) { + private static function createUnicodeString( $str ) { return json_decode( '"' . $str . '"' ); } @@ -156,9 +156,9 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { $db = $this->getMockForViews(); // The first call populate an internal cache of views - $this->assertEquals( array( 'view1', 'view2', 'myview'), + $this->assertEquals( array( 'view1', 'view2', 'myview' ), $db->listViews() ); - $this->assertEquals( array( 'view1', 'view2', 'myview'), + $this->assertEquals( array( 'view1', 'view2', 'myview' ), $db->listViews() ); // Prefix filtering @@ -168,7 +168,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { $db->listViews( 'my' ) ); $this->assertEquals( array(), $db->listViews( 'UNUSED_PREFIX' ) ); - $this->assertEquals( array( 'view1', 'view2', 'myview'), + $this->assertEquals( array( 'view1', 'view2', 'myview' ), $db->listViews( '' ) ); } @@ -179,7 +179,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { function testIsView( $isView, $viewName ) { $db = $this->getMockForViews(); - switch( $isView ) { + switch ( $isView ) { case true: $this->assertTrue( $db->isView( $viewName ), "$viewName should be considered a view" ); diff --git a/tests/phpunit/includes/db/DatabaseTest.php b/tests/phpunit/includes/db/DatabaseTest.php index 301fc99007..35a8e4cdba 100644 --- a/tests/phpunit/includes/db/DatabaseTest.php +++ b/tests/phpunit/includes/db/DatabaseTest.php @@ -109,7 +109,7 @@ class DatabaseTest extends MediaWikiTestCase { } if ( $this->db->getType() === 'oracle' ) { - return strtoupper($database . $quote . $prefix . $table); + return strtoupper( $database . $quote . $prefix . $table ); } else { return $database . $quote . $prefix . $table . $quote; } diff --git a/tests/phpunit/includes/diff/DifferenceEngineTest.php b/tests/phpunit/includes/diff/DifferenceEngineTest.php index 738121aa18..5c3f36a627 100644 --- a/tests/phpunit/includes/diff/DifferenceEngineTest.php +++ b/tests/phpunit/includes/diff/DifferenceEngineTest.php @@ -47,7 +47,7 @@ class DifferenceEngineTest extends MediaWikiTestCase { $strings = array( "it is a kitten", "two kittens", "three kittens", "four kittens" ); $revisions = array(); - foreach( $strings as $string ) { + foreach ( $strings as $string ) { $content = ContentHandler::makeContent( $string, $title ); $page->doEditContent( $content, 'edit page' ); $revisions[] = $page->getLatest(); @@ -59,7 +59,7 @@ class DifferenceEngineTest extends MediaWikiTestCase { public function testMapDiffPrevNext() { $cases = $this->getMapDiffPrevNextCases(); - foreach( $cases as $case ) { + foreach ( $cases as $case ) { list( $expected, $old, $new, $message ) = $case; $diffEngine = new DifferenceEngine( $this->context, $old, $new, 2, true, false ); @@ -81,7 +81,7 @@ class DifferenceEngineTest extends MediaWikiTestCase { public function testLoadRevisionData() { $cases = $this->getLoadRevisionDataCases(); - foreach( $cases as $case ) { + foreach ( $cases as $case ) { list( $expectedOld, $expectedNew, $old, $new, $message ) = $case; $diffEngine = new DifferenceEngine( $this->context, $old, $new, 2, true, false ); diff --git a/tests/phpunit/includes/media/FakeDimensionFile.php b/tests/phpunit/includes/media/FakeDimensionFile.php index 7926000be6..7bc785e690 100644 --- a/tests/phpunit/includes/media/FakeDimensionFile.php +++ b/tests/phpunit/includes/media/FakeDimensionFile.php @@ -25,4 +25,4 @@ class FakeDimensionFile extends File { public function getPath() { return ''; } -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/media/FormatMetadataTest.php b/tests/phpunit/includes/media/FormatMetadataTest.php index 6ff928e4ce..a4f71db547 100644 --- a/tests/phpunit/includes/media/FormatMetadataTest.php +++ b/tests/phpunit/includes/media/FormatMetadataTest.php @@ -65,20 +65,20 @@ class FormatMetadataTest extends MediaWikiTestCase { public static function provideFlattenArray() { return array( - array ( - array(1 ,2 ,3), 'ul', false, false, + array( + array( 1, 2, 3 ), 'ul', false, false, "", ), - array ( - array(1 ,2 ,3), 'ol', false, false, + array( + array( 1, 2, 3 ), 'ol', false, false, "
  1. 1
  2. \n
  3. 2
  4. \n
  5. 3
", ), - array ( - array(1 ,2 ,3), 'ul', true, false, + array( + array( 1, 2, 3 ), 'ul', true, false, "\n*1\n*2\n*3", ), - array ( - array(1 ,2 ,3), 'ol', true, false, + array( + array( 1, 2, 3 ), 'ol', true, false, "\n#1\n#2\n#3", ), // TODO: more test cases diff --git a/tests/phpunit/includes/parser/TidyTest.php b/tests/phpunit/includes/parser/TidyTest.php index 57a88b9d24..d2ab4d3e13 100644 --- a/tests/phpunit/includes/parser/TidyTest.php +++ b/tests/phpunit/includes/parser/TidyTest.php @@ -41,4 +41,4 @@ class TidyTest extends MediaWikiTestCase { array( "\nfoo", 'foo', ' should survive tidy' ), ); } -} \ No newline at end of file +} diff --git a/tests/phpunit/structure/AutoLoaderTest.php b/tests/phpunit/structure/AutoLoaderTest.php index 733368dd63..d8b90d5021 100644 --- a/tests/phpunit/structure/AutoLoaderTest.php +++ b/tests/phpunit/structure/AutoLoaderTest.php @@ -90,6 +90,6 @@ class AutoLoaderTest extends MediaWikiTestCase { $dummyCereal = 'O:29:"testautoloadedserializedclass":0:{}'; $uncerealized = unserialize( $dummyCereal ); $this->assertFalse( $uncerealized instanceof __PHP_Incomplete_Class, - "unserialize() can load classes case-insensitively."); + "unserialize() can load classes case-insensitively." ); } } diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js index be362e22de..90cd546425 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js @@ -554,7 +554,7 @@ QUnit.test( 'formatnum', formatnumTests.length, function ( assert ) { return; } mw.messages.set(test.message ); - mw.config.set( 'wgUserLanguage', test.lang ) ; + mw.config.set( 'wgUserLanguage', test.lang ); var parser = new mw.jqueryMsg.parser( { language: langClass } ); assert.equal( parser.parse( test.integer ? 'formatnum-msg-int' : 'formatnum-msg', -- 2.20.1