From c572d18661093748b8b481219cdf2893f8017d80 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 26 Sep 2015 22:32:31 +0200 Subject: [PATCH] Fixed spacing - Removed space after cast - Removed spaces in array index - Removed double spaces - Added spaces around string concat - Fixed mixed tabs and spaces at begin of line Change-Id: I38e849723f055d2d4c05cba72f5c245a28e8d5da --- includes/EditPage.php | 2 +- includes/Html.php | 2 +- includes/OutputPage.php | 2 +- includes/db/DatabaseSqlite.php | 2 +- includes/db/loadbalancer/LoadMonitorMySQL.php | 6 +++--- includes/debug/logger/LegacyLogger.php | 4 ++-- includes/htmlform/HTMLButtonField.php | 2 +- includes/media/WebP.php | 4 ++-- includes/parser/MWTidy.php | 4 ++-- includes/registration/ExtensionRegistry.php | 2 +- includes/resourceloader/ResourceLoader.php | 2 +- includes/specials/SpecialChangeContentModel.php | 2 +- includes/utils/BatchRowIterator.php | 4 ++-- includes/utils/FileContentsHasher.php | 2 +- tests/phpunit/includes/UserTest.php | 2 +- tests/phpunit/includes/filebackend/SwiftFileBackendTest.php | 2 +- .../phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php | 2 +- 17 files changed, 23 insertions(+), 23 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 05e0ac0ee9..89b484cc8d 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3705,7 +3705,7 @@ HTML $imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos ); $showSignature = true; if ( $title ) { - $showSignature = MWNamespace::wantSignatures( $title->getNamespace() ); + $showSignature = MWNamespace::wantSignatures( $title->getNamespace() ); } /** diff --git a/includes/Html.php b/includes/Html.php index 62ae0b8591..c61dca8a08 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -857,7 +857,7 @@ class Html { } elseif ( is_int( $nsId ) ) { $nsName = $wgContLang->convertNamespace( $nsId ); } - $optionsOut[ $nsId ] = $nsName; + $optionsOut[$nsId] = $nsName; } return $optionsOut; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 552e181553..336e4f48ff 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3973,7 +3973,7 @@ class OutputPage extends ContextSource { $themes = ExtensionRegistry::getInstance()->getAttribute( 'SkinOOUIThemes' ); // Make keys (skin names) lowercase for case-insensitive matching. $themes = array_change_key_case( $themes, CASE_LOWER ); - $theme = isset( $themes[ $skinName ] ) ? $themes[ $skinName ] : 'MediaWiki'; + $theme = isset( $themes[$skinName] ) ? $themes[$skinName] : 'MediaWiki'; // For example, 'OOUI\MediaWikiTheme'. $themeClass = "OOUI\\{$theme}Theme"; OOUI\Theme::setSingleton( new $themeClass() ); diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 7ece56d336..0a7629ee8a 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -985,7 +985,7 @@ class DatabaseSqlite extends DatabaseBase { $indexInfo = $this->query( 'PRAGMA INDEX_INFO(' . $this->addQuotes( $index->name ) . ')' ); $fields = array(); foreach ( $indexInfo as $indexInfoRow ) { - $fields[ $indexInfoRow->seqno ] = $indexInfoRow->name; + $fields[$indexInfoRow->seqno] = $indexInfoRow->name; } $sql .= '(' . implode( ',', $fields ) . ')'; diff --git a/includes/db/loadbalancer/LoadMonitorMySQL.php b/includes/db/loadbalancer/LoadMonitorMySQL.php index 30084190b5..39ced1be88 100644 --- a/includes/db/loadbalancer/LoadMonitorMySQL.php +++ b/includes/db/loadbalancer/LoadMonitorMySQL.php @@ -58,7 +58,7 @@ class LoadMonitorMySQL implements LoadMonitor { # (a) Check the local APC cache $value = $this->srvCache->get( $key ); if ( $value && $value['timestamp'] > ( microtime( true ) - $ttl ) ) { - wfDebugLog( 'replication', __FUNCTION__ . ": got lag times ($key) from local cache" ); + wfDebugLog( 'replication', __FUNCTION__ . ": got lag times ($key) from local cache" ); return $value['lagTimes']; // cache hit } $staleValue = $value ?: false; @@ -67,7 +67,7 @@ class LoadMonitorMySQL implements LoadMonitor { $value = $this->mainCache->get( $key ); if ( $value && $value['timestamp'] > ( microtime( true ) - $ttl ) ) { $this->srvCache->set( $key, $value, $staleTTL ); - wfDebugLog( 'replication', __FUNCTION__ . ": got lag times ($key) from main cache" ); + wfDebugLog( 'replication', __FUNCTION__ . ": got lag times ($key) from main cache" ); return $value['lagTimes']; // cache hit } @@ -106,7 +106,7 @@ class LoadMonitorMySQL implements LoadMonitor { $value = array( 'lagTimes' => $lagTimes, 'timestamp' => microtime( true ) ); $this->mainCache->set( $key, $value, $staleTTL ); $this->srvCache->set( $key, $value, $staleTTL ); - wfDebugLog( 'replication', __FUNCTION__ . ": re-calculated lag times ($key)" ); + wfDebugLog( 'replication', __FUNCTION__ . ": re-calculated lag times ($key)" ); return $value['lagTimes']; } diff --git a/includes/debug/logger/LegacyLogger.php b/includes/debug/logger/LegacyLogger.php index 0f4c648406..bb3c7e13e3 100644 --- a/includes/debug/logger/LegacyLogger.php +++ b/includes/debug/logger/LegacyLogger.php @@ -357,7 +357,7 @@ class LegacyLogger extends AbstractLogger { } if ( is_scalar( $item ) ) { - return (string) $item; + return (string)$item; } if ( is_array( $item ) ) { @@ -376,7 +376,7 @@ class LegacyLogger extends AbstractLogger { if ( is_object( $item ) ) { if ( method_exists( $item, '__toString' ) ) { - return (string) $item; + return (string)$item; } return '[Object ' . get_class( $item ) . ']'; diff --git a/includes/htmlform/HTMLButtonField.php b/includes/htmlform/HTMLButtonField.php index 56a23ad20b..ff0025bc29 100644 --- a/includes/htmlform/HTMLButtonField.php +++ b/includes/htmlform/HTMLButtonField.php @@ -28,7 +28,7 @@ class HTMLButtonField extends HTMLFormField { ) { $prefix = 'mw-ui-'; // add mw-ui-button separately, so the descriptor doesn't need to set it - $flags .= ' ' . $prefix.'button'; + $flags .= ' ' . $prefix . 'button'; } foreach ( $this->mFlags as $flag ) { $flags .= ' ' . $prefix . $flag; diff --git a/includes/media/WebP.php b/includes/media/WebP.php index ff4dcee23e..f894618a76 100644 --- a/includes/media/WebP.php +++ b/includes/media/WebP.php @@ -102,7 +102,7 @@ class WebPHandler extends BitmapHandler { if ( $info['fourCC'] != 'WEBP' ) { wfDebugLog( 'WebP', __METHOD__ . ': FourCC was not WEBP: ' . - bin2hex( $info['fourCC'] ) . " \n" ); + bin2hex( $info['fourCC'] ) . " \n" ); return false; } @@ -187,7 +187,7 @@ class WebPHandler extends BitmapHandler { // Bytes 4-7 are chunk stream size // Byte 8 is 0x2F called the signature if ( $header{8} != "\x2F" ) { - wfDebugLog( 'WebP', __METHOD__ . ': Invalid signature: ' . + wfDebugLog( 'WebP', __METHOD__ . ': Invalid signature: ' . bin2hex( $header{8} ) . "\n" ); return array(); } diff --git a/includes/parser/MWTidy.php b/includes/parser/MWTidy.php index 807842b61c..3a2bb177e6 100644 --- a/includes/parser/MWTidy.php +++ b/includes/parser/MWTidy.php @@ -45,7 +45,7 @@ class MWTidy { public static function tidy( $text ) { $driver = self::singleton(); if ( !$driver ) { - throw new MWException( __METHOD__. + throw new MWException( __METHOD__ . ': tidy is disabled, caller should have checked MWTidy::isEnabled()' ); } return $driver->tidy( $text ); @@ -61,7 +61,7 @@ class MWTidy { public static function checkErrors( $text, &$errorStr = null ) { $driver = self::singleton(); if ( !$driver ) { - throw new MWException( __METHOD__. + throw new MWException( __METHOD__ . ': tidy is disabled, caller should have checked MWTidy::isEnabled()' ); } if ( $driver->supportsValidate() ) { diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index f91aeffaf9..59b9249d41 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -204,7 +204,7 @@ class ExtensionRegistry { ) { // Doesn't match, mark it as incompatible. $incompatible[] = "{$info['name']} is not compatible with the current " - . "MediaWiki core (version {$wgVersion}), it requires: ". $requires[self::MEDIAWIKI_CORE] + . "MediaWiki core (version {$wgVersion}), it requires: " . $requires[self::MEDIAWIKI_CORE] . '.'; continue; } diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index ab36701999..4a9cd0e21b 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -747,7 +747,7 @@ class ResourceLoader implements LoggerAwareInterface { if ( $context->getImageObj() && $this->errors ) { // We can't show both the error messages and the response when it's an image. - $response = implode( "\n\n", $this->errors ); + $response = implode( "\n\n", $this->errors ); } elseif ( $this->errors ) { $errorText = implode( "\n\n", $this->errors ); $errorResponse = self::makeComment( $errorText ); diff --git a/includes/specials/SpecialChangeContentModel.php b/includes/specials/SpecialChangeContentModel.php index cce5da5c12..b0def59367 100644 --- a/includes/specials/SpecialChangeContentModel.php +++ b/includes/specials/SpecialChangeContentModel.php @@ -139,7 +139,7 @@ class SpecialChangeContentModel extends FormSpecialPage { throw new RuntimeException( "Form submission was not POSTed" ); } - $this->title = Title::newFromText( $data['pagetitle' ] ); + $this->title = Title::newFromText( $data['pagetitle'] ); $user = $this->getUser(); // Check permissions and make sure the user has permission to edit the specific page $errors = $this->title->getUserPermissionsErrors( 'editcontentmodel', $user ); diff --git a/includes/utils/BatchRowIterator.php b/includes/utils/BatchRowIterator.php index 9441608aad..fb2ae2a3cd 100644 --- a/includes/utils/BatchRowIterator.php +++ b/includes/utils/BatchRowIterator.php @@ -90,7 +90,7 @@ class BatchRowIterator implements RecursiveIterator { } $this->db = $db; $this->table = $table; - $this->primaryKey = (array) $primaryKey; + $this->primaryKey = (array)$primaryKey; $this->fetchColumns = $this->primaryKey; $this->orderBy = implode( ' ASC,', $this->primaryKey ) . ' ASC'; $this->batchSize = $batchSize; @@ -169,7 +169,7 @@ class BatchRowIterator implements RecursiveIterator { * @return boolean True when the iterator is in a valid state */ public function valid() { - return (bool) $this->current; + return (bool)$this->current; } /** diff --git a/includes/utils/FileContentsHasher.php b/includes/utils/FileContentsHasher.php index 67eb9d29f0..655c1d0b07 100644 --- a/includes/utils/FileContentsHasher.php +++ b/includes/utils/FileContentsHasher.php @@ -93,7 +93,7 @@ class FileContentsHasher { $instance = self::singleton(); if ( !is_array( $filePaths ) ) { - $filePaths = (array) $filePaths; + $filePaths = (array)$filePaths; } if ( count( $filePaths ) === 1 ) { diff --git a/tests/phpunit/includes/UserTest.php b/tests/phpunit/includes/UserTest.php index 77132bbb61..17c1b8e05e 100644 --- a/tests/phpunit/includes/UserTest.php +++ b/tests/phpunit/includes/UserTest.php @@ -527,7 +527,7 @@ class UserTest extends MediaWikiTestCase { $setcookieInvocations = $setcookieSpy->getInvocations(); $setcookieInvocation = end( $setcookieInvocations ); - $actualExpiry = $setcookieInvocation->parameters[ 2 ]; + $actualExpiry = $setcookieInvocation->parameters[2]; // TODO: ± 300 seconds compensates for // slow-running tests. However, the dependency on the time diff --git a/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php b/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php index adcbe74c4b..a683750149 100644 --- a/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php +++ b/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php @@ -75,7 +75,7 @@ class SwiftFileBackendTest extends MediaWikiTestCase { array( 'content-length' => 345, 'content-type' => 'image+bitmap/jpeg', - 'content-disposition' => 'filename='. str_repeat( 'o', 1024 ) . ';inline', + 'content-disposition' => 'filename=' . str_repeat( 'o', 1024 ) . ';inline', 'content-duration' => 35.6363, 'content-custom' => 'hello', 'x-content-custom' => 'hello' diff --git a/tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php b/tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php index 679382b6e3..3f08fd268d 100644 --- a/tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php +++ b/tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php @@ -71,7 +71,7 @@ class MigrateFileRepoLayoutTest extends MediaWikiTestCase { } } - rmdir( $directory ); + rmdir( $directory ); } protected function tearDown() { -- 2.20.1