No spaces after (casts)
authorMatmaRex <matma.rex@gmail.com>
Sat, 31 Aug 2013 16:36:02 +0000 (18:36 +0200)
committerMatmaRex <matma.rex@gmail.com>
Wed, 4 Sep 2013 18:05:43 +0000 (20:05 +0200)
Also removed some unnecessary ones. I think I've caught them all.

The spaceless version already appears in core ~300 times (after
accounting for false positives when grepping). Some consistency would
be nice.

Change-Id: I607655b5f4366e66dc78730d5fd2f57ed8776cae

29 files changed:
includes/AjaxDispatcher.php
includes/GlobalFunctions.php
includes/Html.php
includes/IP.php
includes/Message.php
includes/OutputPage.php
includes/Pager.php
includes/Sanitizer.php
includes/Timestamp.php
includes/UIDGenerator.php
includes/User.php
includes/actions/InfoAction.php
includes/api/ApiOptions.php
includes/api/ApiQuerySiteinfo.php
includes/cache/GenderCache.php
includes/debug/Debug.php
includes/externalstore/ExternalStore.php
includes/logging/DeleteLogFormatter.php
includes/logging/LogEntry.php
includes/media/XMPValidate.php
includes/objectcache/SqlBagOStuff.php
includes/parser/ParserOutput.php
includes/profiler/Profiler.php
includes/specials/SpecialRandomInCategory.php
includes/specials/SpecialUserlogin.php
includes/specials/SpecialWatchlist.php
languages/Language.php
languages/classes/LanguageSr.php
languages/utils/CLDRPluralRuleEvaluator.php

index bddbeb3..c9ca128 100644 (file)
@@ -111,7 +111,7 @@ class AjaxDispatcher {
                        wfHttpError(
                                400,
                                'Bad Request',
-                               "unknown function " . (string) $this->func_name
+                               "unknown function " . $this->func_name
                        );
                } elseif ( !User::isEveryoneAllowed( 'read' ) && !$wgUser->isAllowed( 'read' ) ) {
                        wfHttpError(
index 0060d15..3e7448d 100644 (file)
@@ -3156,9 +3156,9 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1, $lowercase = t
                $sourceBase > 36 ||
                $destBase < 2 ||
                $destBase > 36 ||
-               $sourceBase != (int) $sourceBase ||
-               $destBase != (int) $destBase ||
-               $pad != (int) $pad ||
+               $sourceBase != (int)$sourceBase ||
+               $destBase != (int)$destBase ||
+               $pad != (int)$pad ||
                !preg_match( "/^[" . substr( '0123456789abcdefghijklmnopqrstuvwxyz', 0, $sourceBase ) . "]+$/i", $input )
        ) {
                return false;
@@ -3212,7 +3212,7 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1, $lowercase = t
                                $work += $digit;
 
                                if ( $workDigits || $work >= $destBase ) {
-                                       $workDigits[] = (int) ( $work / $destBase );
+                                       $workDigits[] = (int)( $work / $destBase );
                                }
                                $work %= $destBase;
                        }
index 1d45e6a..3fea3e1 100644 (file)
@@ -846,7 +846,7 @@ class Html {
                # * text/xml
                # * application/xml
                # * Any mimetype with a subtype ending in +xml (this implicitly includes application/xhtml+xml)
-               return (bool) preg_match( '!^(text|application)/xml$|^.+/.+\+xml$!', $mimetype );
+               return (bool)preg_match( '!^(text|application)/xml$|^.+/.+\+xml$!', $mimetype );
        }
 
        /**
index 0943606..2051e69 100644 (file)
@@ -494,8 +494,8 @@ class IP {
                                $n += pow( 2, 32 );
                                # On 32-bit platforms (and on Windows), 2^32 does not fit into an int,
                                # so $n becomes a float. We convert it to string instead.
-                               if ( is_float ( $n ) ) {
-                                       $n = (string) $n;
+                               if ( is_float( $n ) ) {
+                                       $n = (string)$n;
                                }
                        }
                }
index 74b4021..73e0af2 100644 (file)
@@ -423,7 +423,7 @@ class Message {
         * @since 1.20
         */
        public function setInterfaceMessageFlag( $value ) {
-               $this->interface = (bool) $value;
+               $this->interface = (bool)$value;
                return $this;
        }
 
@@ -434,7 +434,7 @@ class Message {
         * @return Message: $this
         */
        public function useDatabase( $value ) {
-               $this->useDatabase = (bool) $value;
+               $this->useDatabase = (bool)$value;
                return $this;
        }
 
index 83a7d3f..4185118 100644 (file)
@@ -1534,7 +1534,7 @@ class OutputPage extends ContextSource {
 
                $popts = $this->parserOptions();
                $oldTidy = $popts->setTidy( $tidy );
-               $popts->setInterfaceMessage( (bool) $interface );
+               $popts->setInterfaceMessage( (bool)$interface );
 
                $parserOutput = $wgParser->parse(
                        $text, $title, $popts,
@@ -2585,7 +2585,7 @@ $templates
        protected function makeResourceLoaderLink( $modules, $only, $useESI = false, array $extraQuery = array(), $loadCall = false ) {
                global $wgResourceLoaderUseESI;
 
-               $modules = (array) $modules;
+               $modules = (array)$modules;
 
                if ( !count( $modules ) ) {
                        return '';
index 3ada0e2..4a14c7e 100644 (file)
@@ -257,7 +257,7 @@ abstract class IndexPager extends ContextSource implements Pager {
         * @param $limit Int|String
         */
        function setLimit( $limit ) {
-               $limit = (int) $limit;
+               $limit = (int)$limit;
                // WebRequest::getLimitOffset() puts a cap of 5000, so do same here.
                if ( $limit > 5000 ) {
                        $limit = 5000;
index d09e8d9..1d20f18 100644 (file)
@@ -1802,6 +1802,6 @@ class Sanitizer {
                $                      # End of string
                /ix"; // case Insensitive, eXtended
 
-               return (bool) preg_match( $HTML5_email_regexp, $addr );
+               return (bool)preg_match( $HTML5_email_regexp, $addr );
        }
 }
index 94ff2f8..48d972c 100644 (file)
@@ -252,7 +252,7 @@ class MWTimestamp {
                        if ( count( $data ) >= 2 ) {
                                // Combination hours and minutes.
                                $diff = abs( (int)$data[0] ) * 60 + (int)$data[1];
-                               if ( (int) $data[0] < 0 ) {
+                               if ( (int)$data[0] < 0 ) {
                                        $diff *= -1;
                                }
                        } else {
index 20ec302..963e51a 100644 (file)
@@ -239,9 +239,9 @@ class UIDGenerator {
                $data = explode( ' ', fgets( $handle ) ); // "<clk seq> <sec> <msec> <counter> <offset>"
                $clockChanged = false; // clock set back significantly?
                if ( count( $data ) == 5 ) { // last UID info already initialized
-                       $clkSeq = (int) $data[0] % $clockSeqSize;
-                       $prevTime = array( (int) $data[1], (int) $data[2] );
-                       $offset = (int) $data[4] % $counterSize; // random counter offset
+                       $clkSeq = (int)$data[0] % $clockSeqSize;
+                       $prevTime = array( (int)$data[1], (int)$data[2] );
+                       $offset = (int)$data[4] % $counterSize; // random counter offset
                        $counter = 0; // counter for UIDs with the same timestamp
                        // Delay until the clock reaches the time of the last ID.
                        // This detects any microtime() drift among processes.
@@ -251,7 +251,7 @@ class UIDGenerator {
                                $time = self::millitime();
                        } elseif ( $time == $prevTime ) {
                                // Bump the counter if there are timestamp collisions
-                               $counter = (int) $data[3] % $counterSize;
+                               $counter = (int)$data[3] % $counterSize;
                                if ( ++$counter >= $counterSize ) { // sanity (starts at 0)
                                        flock( $handle, LOCK_UN ); // abort
                                        throw new MWException( "Counter overflow for timestamp value." );
@@ -328,7 +328,7 @@ class UIDGenerator {
         */
        protected static function millitime() {
                list( $msec, $sec ) = explode( ' ', microtime() );
-               return array( (int) $sec, (int) ( $msec * 1000 ) );
+               return array( (int)$sec, (int)( $msec * 1000 ) );
        }
 
        function __destruct() {
index 74d1e1f..560c5dc 100644 (file)
@@ -2763,7 +2763,7 @@ class User {
                        $this->mEditCount = $count;
                        wfProfileOut( __METHOD__ );
                }
-               return (int) $this->mEditCount;
+               return (int)$this->mEditCount;
        }
 
        /**
@@ -4399,7 +4399,7 @@ class User {
                // Pull from a slave to be less cruel to servers
                // Accuracy isn't the point anyway here
                $dbr = wfGetDB( DB_SLAVE );
-               $count = (int) $dbr->selectField(
+               $count = (int)$dbr->selectField(
                        'revision',
                        'COUNT(rev_user)',
                        array( 'rev_user' => $this->getId() ),
index 704dee4..2c0a875 100644 (file)
@@ -614,7 +614,7 @@ class InfoAction extends FormlessAction {
 
                if ( !$wgDisableCounters ) {
                        // Number of views
-                       $views = (int) $dbr->selectField(
+                       $views = (int)$dbr->selectField(
                                'page',
                                'page_counter',
                                array( 'page_id' => $id ),
@@ -624,7 +624,7 @@ class InfoAction extends FormlessAction {
                }
 
                // Number of page watchers
-               $watchers = (int) $dbr->selectField(
+               $watchers = (int)$dbr->selectField(
                        'watchlist',
                        'COUNT(*)',
                        array(
@@ -636,7 +636,7 @@ class InfoAction extends FormlessAction {
                $result['watchers'] = $watchers;
 
                // Total number of edits
-               $edits = (int) $dbr->selectField(
+               $edits = (int)$dbr->selectField(
                        'revision',
                        'COUNT(rev_page)',
                        array( 'rev_page' => $id ),
@@ -645,7 +645,7 @@ class InfoAction extends FormlessAction {
                $result['edits'] = $edits;
 
                // Total number of distinct authors
-               $authors = (int) $dbr->selectField(
+               $authors = (int)$dbr->selectField(
                        'revision',
                        'COUNT(DISTINCT rev_user_text)',
                        array( 'rev_page' => $id ),
@@ -657,7 +657,7 @@ class InfoAction extends FormlessAction {
                $threshold = $dbr->timestamp( time() - $wgRCMaxAge );
 
                // Recent number of edits
-               $edits = (int) $dbr->selectField(
+               $edits = (int)$dbr->selectField(
                        'revision',
                        'COUNT(rev_page)',
                        array(
@@ -669,7 +669,7 @@ class InfoAction extends FormlessAction {
                $result['recent_edits'] = $edits;
 
                // Recent number of distinct authors
-               $authors = (int) $dbr->selectField(
+               $authors = (int)$dbr->selectField(
                        'revision',
                        'COUNT(DISTINCT rev_user_text)',
                        array(
@@ -687,7 +687,7 @@ class InfoAction extends FormlessAction {
 
                        // Subpages of this page (redirects)
                        $conds['page_is_redirect'] = 1;
-                       $result['subpages']['redirects'] = (int) $dbr->selectField(
+                       $result['subpages']['redirects'] = (int)$dbr->selectField(
                                'page',
                                'COUNT(page_id)',
                                $conds,
@@ -695,7 +695,7 @@ class InfoAction extends FormlessAction {
 
                        // Subpages of this page (non-redirects)
                        $conds['page_is_redirect'] = 0;
-                       $result['subpages']['nonredirects'] = (int) $dbr->selectField(
+                       $result['subpages']['nonredirects'] = (int)$dbr->selectField(
                                'page',
                                'COUNT(page_id)',
                                $conds,
@@ -708,7 +708,7 @@ class InfoAction extends FormlessAction {
                }
 
                // Counts for the number of transclusion links (to/from)
-               $result['transclusion']['to'] = (int) $dbr->selectField(
+               $result['transclusion']['to'] = (int)$dbr->selectField(
                        'templatelinks',
                        'COUNT(tl_from)',
                        array(
@@ -718,7 +718,7 @@ class InfoAction extends FormlessAction {
                        __METHOD__
                );
 
-               $result['transclusion']['from'] = (int) $dbr->selectField(
+               $result['transclusion']['from'] = (int)$dbr->selectField(
                        'templatelinks',
                        'COUNT(*)',
                        array( 'tl_from' => $title->getArticleID() ),
index 720025f..b5aec77 100644 (file)
@@ -87,7 +87,7 @@ class ApiOptions extends ApiBase {
                                case 'registered-checkmatrix':
                                        // A key for a multiselect or checkmatrix option.
                                        $validation = true;
-                                       $value = $value !== null ? (bool) $value : null;
+                                       $value = $value !== null ? (bool)$value : null;
                                        break;
                                case 'userjs':
                                        // Allow non-default preferences prefixed with 'userjs-', to be set by user scripts
index e14baa6..3c22a73 100644 (file)
@@ -139,7 +139,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        $allowException = !empty( $allowFrom );
                }
                if ( $allowException ) {
-                       $data['externalimages'] = (array) $allowFrom;
+                       $data['externalimages'] = (array)$allowFrom;
                        $this->getResult()->setIndexedTagName( $data['externalimages'], 'prefix' );
                }
 
index b7d1b26..a933527 100644 (file)
@@ -143,7 +143,7 @@ class GenderCache {
                $default = $this->getDefault();
 
                $usersToCheck = array();
-               foreach ( (array) $users as $value ) {
+               foreach ( (array)$users as $value ) {
                        $name = self::normalizeUsername( $value );
                        // Skip users whose gender setting we already know
                        if ( !isset( $this->cache[$name] ) ) {
index 9f692c8..6e9ccc4 100644 (file)
@@ -332,7 +332,7 @@ class MWDebug {
                self::$query[] = array(
                        'sql' => $sql,
                        'function' => $function,
-                       'master' => (bool) $isMaster,
+                       'master' => (bool)$isMaster,
                        'time' => 0.0,
                        '_start' => microtime( true ),
                );
index aa89add..462b0b9 100644 (file)
@@ -167,7 +167,7 @@ class ExternalStore {
        public static function insertToDefault( $data, array $params = array() ) {
                global $wgDefaultExternalStore;
 
-               return self::insertWithFallback( (array) $wgDefaultExternalStore, $data, $params );
+               return self::insertWithFallback( (array)$wgDefaultExternalStore, $data, $params );
        }
 
        /**
index 44334ba..01528b7 100644 (file)
@@ -87,9 +87,9 @@ class DeleteLogFormatter extends LogFormatter {
                // Input is like ofield=2134 or just the number
                if ( strpos( $string, 'field=' ) === 1 ) {
                        list( , $field ) = explode( '=', $string );
-                       return (int) $field;
+                       return (int)$field;
                } else {
-                       return (int) $string;
+                       return (int)$string;
                }
        }
 
index 226a1ed..b2a8e50 100644 (file)
@@ -165,7 +165,7 @@ class DatabaseLogEntry extends LogEntryBase {
         */
        public static function newFromRow( $row ) {
                if ( is_array( $row ) && isset( $row['rc_logid'] ) ) {
-                       return new RCDatabaseLogEntry( (object) $row );
+                       return new RCDatabaseLogEntry( (object)$row );
                } else {
                        return new self( $row );
                }
@@ -234,7 +234,7 @@ class DatabaseLogEntry extends LogEntryBase {
 
        public function getPerformer() {
                if ( !$this->performer ) {
-                       $userId = (int) $this->row->log_user;
+                       $userId = (int)$this->row->log_user;
                        if ( $userId !== 0 ) { // logged-in users
                                if ( isset( $this->row->user_name ) ) {
                                        $this->performer = User::newFromRow( $this->row );
@@ -292,7 +292,7 @@ class RCDatabaseLogEntry extends DatabaseLogEntry {
 
        public function getPerformer() {
                if ( !$this->performer ) {
-                       $userId = (int) $this->row->rc_user;
+                       $userId = (int)$this->row->rc_user;
                        if ( $userId !== 0 ) {
                                $this->performer = User::newFromId( $userId );
                        } else {
@@ -472,7 +472,7 @@ class ManualLogEntry extends LogEntryBase {
                        'log_title' => $this->getTarget()->getDBkey(),
                        'log_page' => $this->getTarget()->getArticleID(),
                        'log_comment' => $comment,
-                       'log_params' => serialize( (array) $this->getParameters() ),
+                       'log_params' => serialize( (array)$this->getParameters() ),
                );
                $dbw->insert( 'logging', $data, __METHOD__ );
                $this->id = !is_null( $id ) ? $id : $dbw->insertId();
@@ -534,7 +534,7 @@ class ManualLogEntry extends LogEntryBase {
                        $this->getSubtype(),
                        $this->getTarget(),
                        $this->getComment(),
-                       serialize( (array) $this->getParameters() ),
+                       serialize( (array)$this->getParameters() ),
                        $newId,
                        $formatter->getIRCActionComment() // Used for IRC feeds
                );
@@ -586,7 +586,7 @@ class ManualLogEntry extends LogEntryBase {
        }
 
        public function getDeleted() {
-               return (int) $this->deleted;
+               return (int)$this->deleted;
        }
 
 }
index 3e29c12..87f8abf 100644 (file)
@@ -101,7 +101,7 @@ class XMPValidate {
                        $val = null;
                        return;
                } else {
-                       $nVal = (float) $val;
+                       $nVal = (float)$val;
                        if ( $nVal < 0 ) {
                                // We do < 0 here instead of < -1 here, since
                                // the values between 0 and -1 are also illegal
index b6bf3f8..acf2703 100644 (file)
@@ -364,7 +364,7 @@ class SqlBagOStuff extends BagOStuff {
                        return false;
                }
 
-               return (bool) $db->affectedRows();
+               return (bool)$db->affectedRows();
        }
 
        /**
index 5cb70cb..9519de9 100644 (file)
@@ -284,7 +284,7 @@ class ParserOutput extends CacheTime {
        }
 
        public function addModules( $modules ) {
-               $this->mModules = array_merge( $this->mModules, (array) $modules );
+               $this->mModules = array_merge( $this->mModules, (array)$modules );
        }
 
        public function addModuleScripts( $modules ) {
index 41a9d60..2282a3a 100644 (file)
@@ -594,8 +594,8 @@ class Profiler {
                        $prof .= sprintf( $format,
                                substr( $fname, 0, $nameWidth ),
                                $calls,
-                               (float) ( $elapsed * 1000 ),
-                               (float) ( $elapsed * 1000 ) / $calls,
+                               (float)( $elapsed * 1000 ),
+                               (float)( $elapsed * 1000 ) / $calls,
                                $percent,
                                $memory,
                                ( $this->mMin[$fname] * 1000.0 ),
@@ -665,7 +665,7 @@ 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 );
 
index b8c7b0f..0e022bf 100644 (file)
@@ -132,7 +132,7 @@ class SpecialRandomInCategory extends SpecialPage {
         */
        public function getRandomTitle() {
                // Convert to float, since we do math with the random number.
-               $rand = (float) wfRandom();
+               $rand = (float)wfRandom();
                $title = null;
 
                // Given that timestamps are rather unevenly distributed, we also
index db8ddcd..48bef9d 100644 (file)
@@ -1154,7 +1154,7 @@ class LoginForm extends SpecialPage {
                $template->set( 'usereason', $user->isLoggedIn() );
                $template->set( 'remember', $user->getOption( 'rememberpassword' ) || $this->mRemember );
                $template->set( 'cansecurelogin', ( $wgSecureLogin === true ) );
-               $template->set( 'stickhttps', (int) $this->mStickHTTPS );
+               $template->set( 'stickhttps', (int)$this->mStickHTTPS );
 
                if ( $this->mType === 'signup' && $user->isLoggedIn() ) {
                        $template->set( 'createAnother', true );
index 9ef02fa..59f0dfe 100644 (file)
@@ -452,7 +452,7 @@ class SpecialWatchlist extends SpecialPage {
 
        protected function showHideLink( $options, $message, $name, $value ) {
                $label = $this->msg( $value ? 'show' : 'hide' )->escaped();
-               $options[$name] = 1 - (int) $value;
+               $options[$name] = 1 - (int)$value;
 
                return $this->msg( $message )->rawParams( Linker::linkKnown( $this->getTitle(), $label, array(), $options ) )->escaped();
        }
index 00c3faf..691efe6 100644 (file)
@@ -3624,7 +3624,7 @@ class Language {
                foreach ( $forms as $index => $form ) {
                        if ( preg_match( '/^\d+=/i', $form ) ) {
                                $pos = strpos( $form, '=' );
-                               if ( substr( $form, 0, $pos ) === (string) $count ) {
+                               if ( substr( $form, 0, $pos ) === (string)$count ) {
                                        return substr( $form, $pos + 1 );
                                }
                                unset( $forms[$index] );
index e8811ac..6f0ff4b 100644 (file)
@@ -202,9 +202,9 @@ class SrConverter extends LanguageConverter {
                $numLatin = preg_match_all( "/[šđč枊ĐČĆŽ]/u", $text, $dummy );
 
                if ( $variant == 'sr-ec' ) {
-                       return (boolean) ( $numCyrillic > $numLatin );
+                       return $numCyrillic > $numLatin;
                } elseif ( $variant == 'sr-el' ) {
-                       return (boolean) ( $numLatin > $numCyrillic );
+                       return $numLatin > $numCyrillic;
                } else {
                        return false;
                }
index 43e8aaf..d3a863b 100644 (file)
@@ -127,7 +127,7 @@ class CLDRPluralRuleEvaluator {
                                return !$right->isNumberWithin( $left );
                        case 'mod':
                                if ( is_int( $left ) ) {
-                                       return (int) fmod( $left, $right );
+                                       return (int)fmod( $left, $right );
                                }
                                return fmod( $left, $right );
                        case ',':