Remove spaces after cast operators
authorSam Wilson <sam@samwilson.id.au>
Mon, 31 Oct 2016 04:38:12 +0000 (12:38 +0800)
committerUmherirrender <umherirrender_de.wp@web.de>
Mon, 31 Oct 2016 13:57:39 +0000 (13:57 +0000)
This fixes the outstanding mis-spaced cast operators to bring them
into line with the coding standards on mediawiki.org (and with the
more common usage within this codebase).

Bug: T149545
Change-Id: Ib7bcf95bbee83d20c05f6d621ce7b4e1fb58a347

includes/api/ApiMain.php
includes/api/ApiQueryMyStashedFiles.php
includes/debug/logger/monolog/AvroFormatter.php
includes/json/FormatJson.php
includes/specialpage/LoginSignupSpecialPage.php
includes/utils/UIDGenerator.php
maintenance/validateRegistrationFile.php
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/json/FormatJsonTest.php
tests/phpunit/includes/utils/BatchRowUpdateTest.php
tests/phpunit/structure/ExtensionJsonValidationTest.php

index c8f4460..8deee5c 100644 (file)
@@ -1475,7 +1475,7 @@ class ApiMain extends ApiBase {
                        'ip' => $request->getIP(),
                        'userAgent' => $this->getUserAgent(),
                        'wiki' => wfWikiID(),
-                       'timeSpentBackend' => (int) round( $time * 1000 ),
+                       'timeSpentBackend' => (int)round( $time * 1000 ),
                        'hadError' => $e !== null,
                        'errorCodes' => [],
                        'params' => [],
index 9be5849..0c70a8a 100644 (file)
@@ -92,10 +92,10 @@ class ApiQueryMyStashedFiles extends ApiQueryBase {
                        ];
 
                        if ( isset( $prop['size'] ) ) {
-                               $item['size'] = (int) $row->us_size;
-                               $item['width'] = (int) $row->us_image_width;
-                               $item['height'] = (int) $row->us_image_height;
-                               $item['bits'] = (int) $row->us_image_bits;
+                               $item['size'] = (int)$row->us_size;
+                               $item['width'] = (int)$row->us_image_width;
+                               $item['height'] = (int)$row->us_image_height;
+                               $item['bits'] = (int)$row->us_image_bits;
                        }
 
                        if ( isset( $prop['type'] ) ) {
index f1a01fe..ce0cda1 100644 (file)
@@ -155,7 +155,7 @@ class AvroFormatter implements FormatterInterface {
         */
        public function getSchemaRevisionId( $channel ) {
                if ( isset( $this->schemas[$channel]['revision'] ) ) {
-                       return (int) $this->schemas[$channel]['revision'];
+                       return (int)$this->schemas[$channel]['revision'];
                }
                return null;
        }
index 775ab43..41541ef 100644 (file)
@@ -271,7 +271,7 @@ class FormatJson {
         */
        public static function stripComments( $json ) {
                // Ensure we have a string
-               $str = (string) $json;
+               $str = (string)$json;
                $buffer = '';
                $maxLen = strlen( $str );
                $mark = 0;
index aa5bb4e..984e32b 100644 (file)
@@ -659,7 +659,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
                // make a best effort to get the value of fields which used to be fixed in the old login
                // template but now might or might not exist depending on what providers are used
                $request = $this->getRequest();
-               $data = (object) [
+               $data = (object)[
                        'mUsername' => $request->getText( 'wpName' ),
                        'mPassword' => $request->getText( 'wpPassword' ),
                        'mRetype' => $request->getText( 'wpRetype' ),
index 95b4463..1fd830e 100644 (file)
@@ -554,9 +554,9 @@ class UIDGenerator {
                        $ts = ( 1000 * $sec + $msec ) * 10000 + (int)$offset + $delta;
                        $id_bin = str_pad( decbin( $ts % pow( 2, 60 ) ), 60, '0', STR_PAD_LEFT );
                } elseif ( extension_loaded( 'gmp' ) ) {
-                       $ts = gmp_add( gmp_mul( (string) $sec, '1000' ), (string) $msec ); // ms
+                       $ts = gmp_add( gmp_mul( (string)$sec, '1000' ), (string)$msec ); // ms
                        $ts = gmp_add( gmp_mul( $ts, '10000' ), $offset ); // 100ns intervals
-                       $ts = gmp_add( $ts, (string) $delta );
+                       $ts = gmp_add( $ts, (string)$delta );
                        $ts = gmp_mod( $ts, gmp_pow( '2', '60' ) ); // wrap around
                        $id_bin = str_pad( gmp_strval( $ts, 2 ), 60, '0', STR_PAD_LEFT );
                } elseif ( extension_loaded( 'bcmath' ) ) {
index 7dd0907..b9baf8c 100644 (file)
@@ -58,7 +58,7 @@ class ValidateRegistrationFile extends Maintenance {
                }
 
                $validator = new Validator;
-               $validator->check( $data, (object) [ '$ref' => 'file://' . $schemaPath ] );
+               $validator->check( $data, (object)[ '$ref' => 'file://' . $schemaPath ] );
                if ( $validator->isValid() && !$licenseError ) {
                        $this->output( "$path validates against the version $version schema!\n" );
                } else {
index 9599016..e0f4416 100644 (file)
@@ -1190,7 +1190,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
 
                /** @var ExternalStoreDB $externalStoreDB */
                $externalStoreDB = ExternalStore::getStoreObject( 'DB' );
-               $defaultArray = (array) $wgDefaultExternalStore;
+               $defaultArray = (array)$wgDefaultExternalStore;
                $dbws = [];
                foreach ( $defaultArray as $url ) {
                        if ( strpos( $url, 'DB://' ) === 0 ) {
@@ -1217,7 +1217,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                        return false;
                }
 
-               $defaultArray = (array) $wgDefaultExternalStore;
+               $defaultArray = (array)$wgDefaultExternalStore;
                foreach ( $defaultArray as $url ) {
                        if ( strpos( $url, 'DB://' ) === 0 ) {
                                return true;
index 01b575c..d252c80 100644 (file)
@@ -146,7 +146,7 @@ class FormatJsonTest extends MediaWikiTestCase {
         * @return stdClass|string|bool|int|float|null
         */
        public static function toObject( $value ) {
-               return !is_array( $value ) ? $value : (object) array_map( __METHOD__, $value );
+               return !is_array( $value ) ? $value : (object)array_map( __METHOD__, $value );
        }
 
        /**
index ce6894e..cb1b3d2 100644 (file)
@@ -81,7 +81,7 @@ class BatchRowUpdateTest extends MediaWikiTestCase {
         */
        public function testReaderGetPrimaryKey( $message, array $expected, array $row ) {
                $reader = new BatchRowIterator( $this->mockDb(), 'some_table', array_keys( $expected ), 8675309 );
-               $this->assertEquals( $expected, $reader->extractPrimaryKeys( (object) $row ), $message );
+               $this->assertEquals( $expected, $reader->extractPrimaryKeys( (object)$row ), $message );
        }
 
        public static function provider_readerSetFetchColumns() {
@@ -226,7 +226,7 @@ class BatchRowUpdateTest extends MediaWikiTestCase {
                for ( $i = 0; $i < $numRows; $i += $batchSize ) {
                        $rows = [];
                        for ( $j = 0; $j < $batchSize && $i + $j < $numRows; $j++ ) {
-                               $rows [] = (object) call_user_func( $rowGenerator );
+                               $rows [] = (object)call_user_func( $rowGenerator );
                        }
                        $res[] = $rows;
                }
index ad61284..e11fd8a 100644 (file)
@@ -92,7 +92,7 @@ class ExtensionJsonValidationTest extends PHPUnit_Framework_TestCase {
                }
 
                $validator = new Validator;
-               $validator->check( $data, (object) [ '$ref' => 'file://' . $schemaPath ] );
+               $validator->check( $data, (object)[ '$ref' => 'file://' . $schemaPath ] );
                if ( $validator->isValid() && !$licenseError ) {
                        // All good.
                        $this->assertTrue( true );