From: Sam Wilson Date: Mon, 31 Oct 2016 04:38:12 +0000 (+0800) Subject: Remove spaces after cast operators X-Git-Tag: 1.31.0-rc.0~4993 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=66e215baee366f08fb106823020b74e529cff877;p=lhc%2Fweb%2Fwiklou.git Remove spaces after cast operators 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 --- diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index c8f4460e9f..8deee5c8e1 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -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' => [], diff --git a/includes/api/ApiQueryMyStashedFiles.php b/includes/api/ApiQueryMyStashedFiles.php index 9be5849d34..0c70a8a4ef 100644 --- a/includes/api/ApiQueryMyStashedFiles.php +++ b/includes/api/ApiQueryMyStashedFiles.php @@ -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'] ) ) { diff --git a/includes/debug/logger/monolog/AvroFormatter.php b/includes/debug/logger/monolog/AvroFormatter.php index f1a01fef59..ce0cda12d5 100644 --- a/includes/debug/logger/monolog/AvroFormatter.php +++ b/includes/debug/logger/monolog/AvroFormatter.php @@ -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; } diff --git a/includes/json/FormatJson.php b/includes/json/FormatJson.php index 775ab43c98..41541ef4d6 100644 --- a/includes/json/FormatJson.php +++ b/includes/json/FormatJson.php @@ -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; diff --git a/includes/specialpage/LoginSignupSpecialPage.php b/includes/specialpage/LoginSignupSpecialPage.php index aa5bb4e98c..984e32bdb1 100644 --- a/includes/specialpage/LoginSignupSpecialPage.php +++ b/includes/specialpage/LoginSignupSpecialPage.php @@ -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' ), diff --git a/includes/utils/UIDGenerator.php b/includes/utils/UIDGenerator.php index 95b4463abd..1fd830e4e9 100644 --- a/includes/utils/UIDGenerator.php +++ b/includes/utils/UIDGenerator.php @@ -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' ) ) { diff --git a/maintenance/validateRegistrationFile.php b/maintenance/validateRegistrationFile.php index 7dd0907f64..b9baf8ce72 100644 --- a/maintenance/validateRegistrationFile.php +++ b/maintenance/validateRegistrationFile.php @@ -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 { diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 959901653d..e0f44166d6 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -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; diff --git a/tests/phpunit/includes/json/FormatJsonTest.php b/tests/phpunit/includes/json/FormatJsonTest.php index 01b575ca93..d252c80732 100644 --- a/tests/phpunit/includes/json/FormatJsonTest.php +++ b/tests/phpunit/includes/json/FormatJsonTest.php @@ -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 ); } /** diff --git a/tests/phpunit/includes/utils/BatchRowUpdateTest.php b/tests/phpunit/includes/utils/BatchRowUpdateTest.php index ce6894e04b..cb1b3d2af6 100644 --- a/tests/phpunit/includes/utils/BatchRowUpdateTest.php +++ b/tests/phpunit/includes/utils/BatchRowUpdateTest.php @@ -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; } diff --git a/tests/phpunit/structure/ExtensionJsonValidationTest.php b/tests/phpunit/structure/ExtensionJsonValidationTest.php index ad61284120..e11fd8a548 100644 --- a/tests/phpunit/structure/ExtensionJsonValidationTest.php +++ b/tests/phpunit/structure/ExtensionJsonValidationTest.php @@ -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 );