diff options
author | Thiemo Kreuz <thiemo.kreuz@wikimedia.de> | 2020-02-28 16:13:53 +0100 |
---|---|---|
committer | Krinkle <krinklemail@gmail.com> | 2020-03-04 21:18:30 +0000 |
commit | 6b2c9deef51a63221e99171d3229a6104d22f665 (patch) | |
tree | 5e285923569f935b1f77fee324f43ae67b23d0a2 /tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php | |
parent | 6512ef160c0323b2bb4e89c4eedc8146d4743ae7 (diff) | |
download | mediawikicore-6b2c9deef51a63221e99171d3229a6104d22f665.tar.gz mediawikicore-6b2c9deef51a63221e99171d3229a6104d22f665.zip |
Replace all `new stdClass()` with identical `(object)[]`
This should be the exact same. Its more a style change than anything.
So why do it then?
* I believe this is much less confusing than code mentioning a weird
"standard class". Barely anybody knows what this is, and what the
difference between "object" and "stdClass" is.
* The code is shorter.
* It's even faster. In my micro benchmark it's twice as fast.
Change-Id: I7ee0e8ae6d9264a89b6cd1dd861f0466ae620ccc
Diffstat (limited to 'tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php')
-rw-r--r-- | tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php b/tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php index 247089df2a6f..f8b4d0c5fbeb 100644 --- a/tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php +++ b/tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php @@ -32,9 +32,10 @@ class MigrateFileRepoLayoutTest extends MediaWikiTestCase { ->disableOriginalConstructor() ->getMock(); - $imageRow = new stdClass; - $imageRow->img_name = $filename; - $imageRow->img_sha1 = sha1( $this->text ); + $imageRow = (object)[ + 'img_name' => $filename, + 'img_sha1' => sha1( $this->text ), + ]; $dbMock->expects( $this->any() ) ->method( 'select' ) |