aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/api/ApiResultTest.php
diff options
context:
space:
mode:
authorThiemo Kreuz <thiemo.kreuz@wikimedia.de>2020-05-29 08:23:59 +0200
committerThiemo Kreuz <thiemo.kreuz@wikimedia.de>2020-05-29 08:23:59 +0200
commitedd26046e90e640c37c589ef6082d3545044a6d5 (patch)
tree8ca34ae87091caa90b45af5c86b14ae0a5ce48b9 /tests/phpunit/includes/api/ApiResultTest.php
parentbbce47b29de1587eb2dba2d2cdd4ebd5df1ed52e (diff)
downloadmediawikicore-edd26046e90e640c37c589ef6082d3545044a6d5.tar.gz
mediawikicore-edd26046e90e640c37c589ef6082d3545044a6d5.zip
Simplify \stdClass object creation in ApiResultTest
I find this …->{…} curly bracket syntax surprising and confusing, and try to avoid it as hard as I can. And that's indeed very, very easy here. Note this really creates the exact same \stdClass object. Change-Id: I612184be877b2aa404db9829a827cfcec2d253cf
Diffstat (limited to 'tests/phpunit/includes/api/ApiResultTest.php')
-rw-r--r--tests/phpunit/includes/api/ApiResultTest.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/phpunit/includes/api/ApiResultTest.php b/tests/phpunit/includes/api/ApiResultTest.php
index 51d593821c5a..e31e66d40785 100644
--- a/tests/phpunit/includes/api/ApiResultTest.php
+++ b/tests/phpunit/includes/api/ApiResultTest.php
@@ -219,8 +219,7 @@ class ApiResultTest extends MediaWikiTestCase {
1 => "\xc3\xa1",
], $arr );
- $obj = (object)[];
- $obj->{'1'} = 'one';
+ $obj = (object)[ 1 => 'one' ];
$arr = [];
ApiResult::setValue( $arr, 'foo', $obj );
$this->assertSame( [
@@ -522,8 +521,7 @@ class ApiResultTest extends MediaWikiTestCase {
], $result->getResultData() );
$result = new ApiResult( 8388608 );
- $obj = (object)[];
- $obj->{'1'} = 'one';
+ $obj = (object)[ 1 => 'one' ];
$arr = [];
$result->addValue( $arr, 'foo', $obj );
$this->assertSame( [