So the conditional check should by default return $this->mDb if it's not
null, so, the else seems not to be needed(?). If we have a database handle
to process the current batch, $this->getDB() will return IMaintainableDatabase
but if it's not available (null), a call to $this->getDB() will return an
instance of \Wikimedia\Rdbms\Database is returned instead.
In accordance with the documentation (phpdoc), update the method getUserDB()
to be compliant with callers return type.
Change-Id: I95f3407dd2ffe8e4a1ad7a70be86b6cf3b65ff50
* @return IMaintainableDatabase
*/
protected function getDB( $db, $groups = [], $wiki = false ) {
- if ( is_null( $this->mDb ) ) {
+ if ( $this->mDb === null ) {
return wfGetDB( $db, $groups, $wiki );
- } else {
- return $this->mDb;
}
+ return $this->mDb;
}
/**
/**
* Get the master DB handle for the current user batch. This is provided for the benefit
* of authentication extensions which subclass this and work with wiki farms.
+ * @return IMaintainableDatabase
*/
protected function getUserDB() {
return $this->getDB( DB_MASTER );