From 15ff79312dca530b4888ef618c6b25e0cba832a2 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 17 May 2013 16:47:00 +0200 Subject: [PATCH] Fixed spacing and removed unneeded parenthesis Added spaces after/before parenthesis Removed unneeded parenthesis around some statements Broke a long line Change-Id: I7fbe129f7bbf524dd0598ece2a9708643f08453b --- includes/Cdb_PHP.php | 4 ++-- includes/ChangesList.php | 2 +- includes/ConfEditor.php | 8 +++---- includes/FeedUtils.php | 2 +- includes/HTMLForm.php | 4 ++-- includes/MagicWord.php | 6 ++--- includes/Message.php | 2 +- includes/Pager.php | 2 +- includes/ProtectionForm.php | 2 +- includes/Sanitizer.php | 12 +++++----- includes/SiteConfiguration.php | 2 +- includes/StubObject.php | 4 ++-- includes/Xml.php | 4 ++-- includes/cache/LinkBatch.php | 2 +- includes/filerepo/file/ArchivedFile.php | 2 +- includes/filerepo/file/OldLocalFile.php | 2 +- includes/logging/LogEventsList.php | 2 +- includes/media/GIFMetadataExtractor.php | 4 ++-- includes/media/Tiff.php | 2 +- includes/profiler/Profiler.php | 22 ++++++++++++++----- includes/specials/SpecialPrefixindex.php | 2 +- includes/specials/SpecialRecentchanges.php | 2 +- includes/specials/SpecialRevisiondelete.php | 2 +- .../phpunit/includes/HTMLCheckMatrixTest.php | 10 ++++----- tests/phpunit/includes/HashRingTest.php | 4 ++-- .../phpunit/includes/parser/NewParserTest.php | 4 ++-- .../specials/SpecialPreferencesTest.php | 8 +++---- .../mocks/filebackend/MockFileBackend.php | 18 +++++++-------- 28 files changed, 75 insertions(+), 65 deletions(-) diff --git a/includes/Cdb_PHP.php b/includes/Cdb_PHP.php index 166242ae2a..a38b9a86b8 100644 --- a/includes/Cdb_PHP.php +++ b/includes/Cdb_PHP.php @@ -73,10 +73,10 @@ class CdbFunctions { public static function hash( $s ) { $h = 5381; for ( $i = 0; $i < strlen( $s ); $i++ ) { - $h5 = ($h << 5) & 0xffffffff; + $h5 = ( $h << 5 ) & 0xffffffff; // Do a 32-bit sum // Inlined here for speed - $sum = ($h & 0x3fffffff) + ($h5 & 0x3fffffff); + $sum = ( $h & 0x3fffffff ) + ( $h5 & 0x3fffffff ); $h = ( ( $sum & 0x40000000 ? 1 : 0 ) diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 5ecd4d9090..1b6b396c93 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -844,7 +844,7 @@ class EnhancedChangesList extends ChangesList { $secureName = $title->getPrefixedDBkey(); if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) { # Use an @ character to prevent collision with page names - $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array( $rc ); + $this->rc_cache['@@' . ( $this->rcMoveIndex++ )] = array( $rc ); } else { # Logs are grouped by type if ( $type == RC_LOG ) { diff --git a/includes/ConfEditor.php b/includes/ConfEditor.php index 78af1c102e..67cb87db1e 100644 --- a/includes/ConfEditor.php +++ b/includes/ConfEditor.php @@ -570,7 +570,7 @@ class ConfEditor { public function parse() { $this->initParse(); $this->pushState( 'file' ); - $this->pushPath( '@extra-' . ($this->serial++) ); + $this->pushPath( '@extra-' . ( $this->serial++ ) ); $token = $this->firstToken(); while ( !$token->isEnd() ) { @@ -642,7 +642,7 @@ class ConfEditor { } $this->skipSpace(); $this->expect( ';' ); - $this->nextPath( '@extra-' . ($this->serial++) ); + $this->nextPath( '@extra-' . ( $this->serial++ ) ); break; case 'expression': $token = $this->skipSpace(); @@ -662,7 +662,7 @@ class ConfEditor { $this->skipSpace(); $this->expect( '(' ); $this->skipSpace(); - $this->pushPath( '@extra-' . ($this->serial++) ); + $this->pushPath( '@extra-' . ( $this->serial++ ) ); if ( $this->isAhead( ')' ) ) { // Empty array $this->pushState( 'array end' ); @@ -694,7 +694,7 @@ class ConfEditor { $this->endPathValue(); $this->markComma(); $this->nextToken(); - $this->nextPath( '@extra-' . ($this->serial++) ); + $this->nextPath( '@extra-' . ( $this->serial++ ) ); // Look ahead to find ending bracket if ( $this->isAhead( ")" ) ) { // Found ending bracket, no continuation diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 1d3b3c82de..22cb52beba 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -84,7 +84,7 @@ class FeedUtils { return self::formatDiffRow( $titleObj, $row->rc_last_oldid, $row->rc_this_oldid, $timestamp, - ($row->rc_deleted & Revision::DELETED_COMMENT) + $row->rc_deleted & Revision::DELETED_COMMENT ? wfMessage( 'rev-deleted-comment' )->escaped() : $row->rc_comment, $actiontext diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index e2fa5fd1cc..7adbfc8947 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -1940,7 +1940,7 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable { 'id' => "{$this->mID}-$thisTag", 'value' => $thisTag, ); - $checked = in_array( $thisTag, (array)$value, true); + $checked = in_array( $thisTag, (array)$value, true ); if ( $this->isTagForcedOff( $thisTag ) ) { $checked = false; $thisAttribs['disabled'] = 1; @@ -2049,7 +2049,7 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable { $thisTag = "$column-$row"; if ( $this->isTagForcedOff( $thisTag ) ) { $res[$thisTag] = false; - } elseif ($this->isTagForcedOn( $thisTag ) ) { + } elseif ( $this->isTagForcedOn( $thisTag ) ) { $res[$thisTag] = true; } else { $res[$thisTag] = in_array( $thisTag, $data ); diff --git a/includes/MagicWord.php b/includes/MagicWord.php index f9457c3bdc..ae7f8fed74 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -514,7 +514,7 @@ class MagicWord { */ function replace( $replacement, $subject, $limit = -1 ) { $res = preg_replace( $this->getRegex(), StringUtils::escapeRegexReplacement( $replacement ), $subject, $limit ); - $this->mModified = !($res === $subject); + $this->mModified = $res !== $subject; return $res; } @@ -530,7 +530,7 @@ class MagicWord { */ function substituteCallback( $text, $callback ) { $res = preg_replace_callback( $this->getVariableRegex(), $callback, $text ); - $this->mModified = !($res === $text); + $this->mModified = $res !== $text; return $res; } @@ -609,7 +609,7 @@ class MagicWord { } $result = preg_replace( $search, $replace, $subject ); - return !($result === $subject); + return $result !== $subject; } /** diff --git a/includes/Message.php b/includes/Message.php index 531551dabb..de0b17eeb7 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -644,7 +644,7 @@ class Message { foreach ( $this->parameters as $n => $param ) { list( $paramType, $value ) = $this->extractParam( $param ); if ( $type === $paramType ) { - $replacementKeys['$' . ($n + 1)] = $value; + $replacementKeys['$' . ( $n + 1 )] = $value; } } $message = strtr( $message, $replacementKeys ); diff --git a/includes/Pager.php b/includes/Pager.php index 696c11bda4..c2bd364687 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -593,7 +593,7 @@ abstract class IndexPager extends ContextSource implements Pager { $this->doQuery(); } // Hide navigation by default if there is nothing to page - return !($this->mIsFirst && $this->mIsLast); + return !( $this->mIsFirst && $this->mIsLast ); } /** diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 0871cf0edc..6f444ee3d1 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -386,7 +386,7 @@ class ProtectionForm { 'mwProtect-reason', 4 ); $scExpiryOptions = wfMessage( 'protect-expiry-options' )->inContentLanguage()->text(); - $showProtectOptions = ($scExpiryOptions !== '-' && !$this->disabled); + $showProtectOptions = $scExpiryOptions !== '-' && !$this->disabled; $mProtectexpiry = Xml::label( wfMessage( 'protectexpiry' )->text(), diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index d3e3d1a1e2..ed01235da7 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -1305,12 +1305,12 @@ class Sanitizer { * @return Boolean */ private static function validateCodepoint( $codepoint ) { - return ($codepoint == 0x09) - || ($codepoint == 0x0a) - || ($codepoint == 0x0d) - || ($codepoint >= 0x20 && $codepoint <= 0xd7ff) - || ($codepoint >= 0xe000 && $codepoint <= 0xfffd) - || ($codepoint >= 0x10000 && $codepoint <= 0x10ffff); + return $codepoint == 0x09 + || $codepoint == 0x0a + || $codepoint == 0x0d + || ( $codepoint >= 0x20 && $codepoint <= 0xd7ff ) + || ( $codepoint >= 0xe000 && $codepoint <= 0xfffd ) + || ( $codepoint >= 0x10000 && $codepoint <= 0x10ffff ); } /** diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index 63c3d34d89..82344289e5 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -317,7 +317,7 @@ class SiteConfiguration { * @return bool The value of the setting requested. */ public function getBool( $setting, $wiki, $suffix = null, $wikiTags = array() ) { - return (bool)($this->get( $setting, $wiki, $suffix, array(), $wikiTags ) ); + return (bool)$this->get( $setting, $wiki, $suffix, array(), $wikiTags ); } /** diff --git a/includes/StubObject.php b/includes/StubObject.php index 5b26d45fb1..59238faa90 100644 --- a/includes/StubObject.php +++ b/includes/StubObject.php @@ -60,7 +60,7 @@ class StubObject { * @return Boolean: true if $obj is not an instance of StubObject class. */ static function isRealObject( $obj ) { - return is_object( $obj ) && !($obj instanceof StubObject); + return is_object( $obj ) && !$obj instanceof StubObject; } /** @@ -113,7 +113,7 @@ class StubObject { function _unstub( $name = '_unstub', $level = 2 ) { static $recursionLevel = 0; - if ( !($GLOBALS[$this->mGlobal] instanceof StubObject) ) { + if ( !$GLOBALS[$this->mGlobal] instanceof StubObject ) { return $GLOBALS[$this->mGlobal]; // already unstubbed. } diff --git a/includes/Xml.php b/includes/Xml.php index 3eedeb20b5..223061a1a7 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -243,7 +243,7 @@ class Xml { $selected = isset( $languages[$selected] ) ? $selected : $wgLanguageCode; $options = "\n"; foreach ( $languages as $code => $name ) { - $options .= Xml::option( "$code - $name", $code, ($code == $selected) ) . "\n"; + $options .= Xml::option( "$code - $name", $code, $code == $selected ) . "\n"; } $attrs = array( 'id' => 'wpUserLanguage', 'name' => 'wpUserLanguage' ); @@ -889,7 +889,7 @@ class XmlSelect { */ public function addOption( $name, $value = false ) { // Stab stab stab - $value = ($value !== false) ? $value : $name; + $value = $value !== false ? $value : $name; $this->options[] = array( $name => $value ); } diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index f47107c68f..48b60aa978 100644 --- a/includes/cache/LinkBatch.php +++ b/includes/cache/LinkBatch.php @@ -98,7 +98,7 @@ class LinkBatch { * @return bool */ public function isEmpty() { - return ($this->getSize() == 0); + return $this->getSize() == 0; } /** diff --git a/includes/filerepo/file/ArchivedFile.php b/includes/filerepo/file/ArchivedFile.php index b753e18a25..6c4bf8ae7c 100644 --- a/includes/filerepo/file/ArchivedFile.php +++ b/includes/filerepo/file/ArchivedFile.php @@ -491,7 +491,7 @@ class ArchivedFile { */ public function isDeleted( $field ) { $this->load(); - return ($this->deleted & $field) == $field; + return ( $this->deleted & $field ) == $field; } /** diff --git a/includes/filerepo/file/OldLocalFile.php b/includes/filerepo/file/OldLocalFile.php index 2e86ae15f6..2c545963c3 100644 --- a/includes/filerepo/file/OldLocalFile.php +++ b/includes/filerepo/file/OldLocalFile.php @@ -291,7 +291,7 @@ class OldLocalFile extends LocalFile { */ function isDeleted( $field ) { $this->load(); - return ($this->deleted & $field) == $field; + return ( $this->deleted & $field ) == $field; } /** diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index 7025332a50..2150019cd9 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -74,7 +74,7 @@ class LogEventsList extends ContextSource { public function showHeader( $type ) { wfDeprecated( __METHOD__, '1.19' ); // If only one log type is used, then show a special message... - $headerType = (count( $type ) == 1) ? $type[0] : ''; + $headerType = count( $type ) == 1 ? $type[0] : ''; $out = $this->getOutput(); if ( LogPage::isLogType( $headerType ) ) { $page = new LogPage( $headerType ); diff --git a/includes/media/GIFMetadataExtractor.php b/includes/media/GIFMetadataExtractor.php index 968a2cdd5d..a4a67534f6 100644 --- a/includes/media/GIFMetadataExtractor.php +++ b/includes/media/GIFMetadataExtractor.php @@ -183,7 +183,7 @@ class GIFMetadataExtractor { if ( $blockLength != 11 ) { wfDebug( __METHOD__ . ' GIF application block with wrong length' ); - fseek( $fh, -($blockLength + 1), SEEK_CUR ); + fseek( $fh, -( $blockLength + 1 ), SEEK_CUR ); self::skipBlock( $fh ); continue; } @@ -228,7 +228,7 @@ class GIFMetadataExtractor { } else { // unrecognized extension block - fseek( $fh, -($blockLength + 1), SEEK_CUR ); + fseek( $fh, -( $blockLength + 1 ), SEEK_CUR ); self::skipBlock( $fh ); continue; } diff --git a/includes/media/Tiff.php b/includes/media/Tiff.php index 0042208bbb..55acb120e6 100644 --- a/includes/media/Tiff.php +++ b/includes/media/Tiff.php @@ -43,7 +43,7 @@ class TiffHandler extends ExifBitmapHandler { function canRender( $file ) { global $wgTiffThumbnailType; return (bool)$wgTiffThumbnailType - || ($file->getRepo() instanceof ForeignAPIRepo); + || $file->getRepo() instanceof ForeignAPIRepo; } /** diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index 6f112aeb3d..194bafed2b 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -462,8 +462,8 @@ class Profiler { # Adjust for profiling overhead (except special values with elapsed=0 if ( $elapsed ) { $elapsed -= $overheadInternal; - $elapsed -= ($subcalls * $overheadTotal); - $memory -= ($subcalls * $overheadMemory); + $elapsed -= ( $subcalls * $overheadTotal ); + $memory -= ( $subcalls * $overheadMemory ); } } @@ -509,7 +509,17 @@ class Profiler { $calls = $this->mCalls[$fname]; $percent = $total ? 100. * $elapsed / $total : 0; $memory = $this->mMemory[$fname]; - $prof .= sprintf( $format, substr( $fname, 0, $nameWidth ), $calls, (float) ($elapsed * 1000), (float) ($elapsed * 1000) / $calls, $percent, $memory, ( $this->mMin[$fname] * 1000.0 ), ( $this->mMax[$fname] * 1000.0 ), $this->mOverhead[$fname] ); + $prof .= sprintf( $format, + substr( $fname, 0, $nameWidth ), + $calls, + (float) ( $elapsed * 1000 ), + (float) ( $elapsed * 1000 ) / $calls, + $percent, + $memory, + ( $this->mMin[$fname] * 1000.0 ), + ( $this->mMax[$fname] * 1000.0 ), + $this->mOverhead[$fname] + ); } $prof .= "\nTotal: $total\n\n"; @@ -573,13 +583,13 @@ class Profiler { foreach ( $this->mCollated as $name => $elapsed ) { $eventCount = $this->mCalls[$name]; - $timeSum = (float) ($elapsed * 1000); + $timeSum = (float) ( $elapsed * 1000 ); $memorySum = (float)$this->mMemory[$name]; $name = substr( $name, 0, 255 ); // Kludge - $timeSum = ($timeSum >= 0) ? $timeSum : 0; - $memorySum = ($memorySum >= 0) ? $memorySum : 0; + $timeSum = $timeSum >= 0 ? $timeSum : 0; + $memorySum = $memorySum >= 0 ? $memorySum : 0; $dbw->update( 'profiling', array( diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 065c141c62..f9147024a4 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -212,7 +212,7 @@ class SpecialPrefixindex extends SpecialAllpages { $out .= ''; } } - if ( ($n % 3) != 0 ) { + if ( $n % 3 != 0 ) { $out .= ''; } $out .= Xml::closeElement( 'table' ); diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 09170699a7..ad6346de21 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -294,7 +294,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { // Calculate cutoff $cutoff_unixtime = time() - ( $opts['days'] * 86400 ); - $cutoff_unixtime = $cutoff_unixtime - ($cutoff_unixtime % 86400); + $cutoff_unixtime = $cutoff_unixtime - ( $cutoff_unixtime % 86400 ); $cutoff = $dbr->timestamp( $cutoff_unixtime ); $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] ); diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 9249f27341..9f4b9da84d 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -609,7 +609,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { if ( $val == 1 ) { $newBits |= $const; // $const is the *_deleted const } elseif ( $val == -1 ) { - $newBits |= ($oldfield & $const); // use existing + $newBits |= ( $oldfield & $const ); // use existing } } return $newBits; diff --git a/tests/phpunit/includes/HTMLCheckMatrixTest.php b/tests/phpunit/includes/HTMLCheckMatrixTest.php index 4e50e04894..5bbafd37c1 100644 --- a/tests/phpunit/includes/HTMLCheckMatrixTest.php +++ b/tests/phpunit/includes/HTMLCheckMatrixTest.php @@ -18,12 +18,12 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase { return; } - $this->fail('Expected MWException indicating missing parameters but none was thrown.'); + $this->fail( 'Expected MWException indicating missing parameters but none was thrown.' ); } public function testInstantiationWithMinimumRequiredParameters() { $form = new HTMLCheckMatrix( self::$defaultOptions ); - $this->assertTrue(true); // form instantiation must throw exception on failure + $this->assertTrue( true ); // form instantiation must throw exception on failure } public function testValidateCallsUserDefinedValidationCallback() { @@ -49,7 +49,7 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase { public function testValidateAllowsOnlyKnownTags() { $field = new HTMLCheckMatrix( self::$defaultOptions ); - $this->assertInternalType('string', $this->validate( $field, array( 'foo' ) ) ); + $this->assertInternalType( 'string', $this->validate( $field, array( 'foo' ) ) ); } public function testValidateAcceptsPartialTagList() { @@ -76,7 +76,7 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase { 'c2-r1' => true, 'c2-r2' => false, ); - $this->assertEquals($expected, $field->filterDataForSubmit( array() ) ); + $this->assertEquals( $expected, $field->filterDataForSubmit( array() ) ); } public function testValuesForcedOffRemainOff() { @@ -90,7 +90,7 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase { 'c2-r2' => false, ); // array_keys on the result simulates submitting all fields checked - $this->assertEquals($expected, $field->filterDataForSubmit( array_keys($expected) ) ); + $this->assertEquals( $expected, $field->filterDataForSubmit( array_keys( $expected ) ) ); } protected function validate( HTMLFormField $field, $submitted ) { diff --git a/tests/phpunit/includes/HashRingTest.php b/tests/phpunit/includes/HashRingTest.php index 2d47fdf21c..bc4e499c29 100644 --- a/tests/phpunit/includes/HashRingTest.php +++ b/tests/phpunit/includes/HashRingTest.php @@ -8,7 +8,7 @@ class HashRingTest extends MediaWikiTestCase { $ring = new HashRing( array( 's1' => 1, 's2' => 1, 's3' => 2, 's4' => 2, 's5' => 2, 's6' => 3 ) ); $locations = array(); - for ( $i=0; $i<20; $i++ ) { + for ( $i = 0; $i < 20; $i++ ) { $locations[ "hello$i"] = $ring->getLocation( "hello$i" ); } $expectedLocations = array( @@ -37,7 +37,7 @@ class HashRingTest extends MediaWikiTestCase { $this->assertEquals( $expectedLocations, $locations, 'Items placed at proper locations' ); $locations = array(); - for ( $i=0; $i<5; $i++ ) { + for ( $i = 0; $i < 5; $i++ ) { $locations[ "hello$i"] = $ring->getLocations( "hello$i", 2 ); } diff --git a/tests/phpunit/includes/parser/NewParserTest.php b/tests/phpunit/includes/parser/NewParserTest.php index 288fa82e33..8cee07bad6 100644 --- a/tests/phpunit/includes/parser/NewParserTest.php +++ b/tests/phpunit/includes/parser/NewParserTest.php @@ -110,7 +110,7 @@ class NewParserTest extends MediaWikiTestCase { # actual thumbnails to do parser testing, we only care about receiving # a ThumbnailImage properly initialized. global $wgMediaHandlers; - foreach( $wgMediaHandlers as $type => $handler ) { + foreach ( $wgMediaHandlers as $type => $handler ) { $tmpGlobals['wgMediaHandlers'][$type] = 'MockBitmapHandler'; } @@ -463,7 +463,7 @@ class NewParserTest extends MediaWikiTestCase { } $backend = RepoGroup::singleton()->getLocalRepo()->getBackend(); - if( $backend instanceof MockFileBackend ) { + if ( $backend instanceof MockFileBackend ) { # In memory backend, so dont bother cleaning them up. return; } diff --git a/tests/phpunit/includes/specials/SpecialPreferencesTest.php b/tests/phpunit/includes/specials/SpecialPreferencesTest.php index d4bba61599..c7a48282ec 100644 --- a/tests/phpunit/includes/specials/SpecialPreferencesTest.php +++ b/tests/phpunit/includes/specials/SpecialPreferencesTest.php @@ -22,17 +22,17 @@ class SpecialPreferencesTest extends MediaWikiTestCase { $user = $this->getMock( 'User' ); $user->expects( $this->any() ) - ->method('isAnon') - ->will( $this->returnValue(false) ); + ->method( 'isAnon' ) + ->will( $this->returnValue( false ) ); # Yeah foreach requires an array, not NULL =( $user->expects( $this->any() ) - ->method('getEffectiveGroups') + ->method( 'getEffectiveGroups' ) ->will( $this->returnValue( array() ) ); # The mocked user has a long nickname $user->expects( $this->any() ) - ->method('getOption') + ->method( 'getOption' ) ->will( $this->returnValueMap( array( array( 'nickname', null, false, 'superlongnickname' ), ) diff --git a/tests/phpunit/mocks/filebackend/MockFileBackend.php b/tests/phpunit/mocks/filebackend/MockFileBackend.php index c681989c0f..49aefbd147 100644 --- a/tests/phpunit/mocks/filebackend/MockFileBackend.php +++ b/tests/phpunit/mocks/filebackend/MockFileBackend.php @@ -42,24 +42,24 @@ class MockFileBackend extends FileBackendStore { } protected function doCreateInternal( array $params ) { - if( isset( $params['content'] ) ) { + if ( isset( $params['content'] ) ) { $content = $params['content']; } else { $content = 'Default mocked file content'; } - $this->debug(serialize($params)); + $this->debug( serialize( $params ) ); $dst = $params['dst']; $this->mocked[$dst] = $content; return Status::newGood(); } protected function doStoreInternal( array $params ) { - $this->debug(serialize($params)); + $this->debug( serialize( $params ) ); return $this->doCreateInternal( $params ); } protected function doCopyInternal( array $params ) { - $this->debug(serialize($params)); + $this->debug( serialize( $params ) ); $src = $params['src']; $dst = $params['dst']; $this->mocked[$dst] = $this->mocked[$src]; @@ -67,7 +67,7 @@ class MockFileBackend extends FileBackendStore { } protected function doDeleteInternal( array $params ) { - $this->debug(serialize($params)); + $this->debug( serialize( $params ) ); $src = $params['src']; unset( $this->mocked[$src] ); return Status::newGood(); @@ -75,7 +75,7 @@ class MockFileBackend extends FileBackendStore { protected function doGetFileStat( array $params ) { $src = $params['src']; - if( array_key_exists( $src, $this->mocked ) ) { + if ( array_key_exists( $src, $this->mocked ) ) { $this->debug( "('$src') found" ); return array( 'mtime' => wfTimestamp( TS_MW ), @@ -91,10 +91,10 @@ class MockFileBackend extends FileBackendStore { protected function doGetLocalCopyMulti( array $params ) { $tmpFiles = array(); // (path => MockFSFile) - $this->debug( '(' . serialize($params) . ')' ); - foreach( $params['srcs'] as $src ) { + $this->debug( '(' . serialize( $params ) . ')' ); + foreach ( $params['srcs'] as $src ) { $tmpFiles[$src] = new MockFSFile( - wfTempDir() . '/' . wfRandomString(32) + wfTempDir() . '/' . wfRandomString( 32 ) ); } return $tmpFiles; -- 2.20.1