rdbms: Use more narrow type hints in LBFactoryTest
authorThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Tue, 12 Feb 2019 12:01:26 +0000 (13:01 +0100)
committerKrinkle <krinklemail@gmail.com>
Wed, 13 Feb 2019 18:27:26 +0000 (18:27 +0000)
Originally I wanted to fix the broken type hint for the `Database`
class. But I ended limiting the scope as much as possible and only
type hint at the interfaces that contain the methods the code actually
needs.

Change-Id: I450a55e80612f6e676f7c803dc904b4b653426d8

tests/phpunit/includes/db/LBFactoryTest.php

index 58f9654..3d1bf59 100644 (file)
@@ -23,6 +23,9 @@
  * @copyright © 2013 Wikimedia Foundation Inc.
  */
 
+use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\IMaintainableDatabase;
 use Wikimedia\Rdbms\LBFactory;
 use Wikimedia\Rdbms\LBFactorySimple;
 use Wikimedia\Rdbms\LBFactoryMulti;
@@ -456,7 +459,7 @@ class LBFactoryTest extends MediaWikiTestCase {
                );
                unset( $db );
 
-               /** @var Database $db */
+               /** @var IMaintainableDatabase $db */
                $db = $lb->getConnection( DB_MASTER, [], '' );
 
                $this->assertEquals(
@@ -531,7 +534,7 @@ class LBFactoryTest extends MediaWikiTestCase {
                        ]
                );
                $lb = $factory->getMainLB();
-               /** @var Database $db */
+               /** @var IMaintainableDatabase $db */
                $db = $lb->getConnection( DB_MASTER, [], '' );
 
                $this->assertEquals( '', $db->getDomainID(), "Null domain used" );
@@ -592,7 +595,7 @@ class LBFactoryTest extends MediaWikiTestCase {
                        ]
                );
                $lb = $factory->getMainLB();
-               /** @var Database $db */
+               /** @var IDatabase $db */
                $db = $lb->getConnection( DB_MASTER, [], '' );
 
                if ( $db->getType() === 'sqlite' ) {