class DBConnRef implements IDatabase {
/** @var ILoadBalancer */
private $lb;
-
- /** @var IDatabase|null Live connection handle */
+ /** @var Database|null Live connection handle */
private $conn;
-
/** @var array|null N-tuple of (server index, group, DatabaseDomain|string) */
private $params;
const FLD_DOMAIN = 2;
/**
- * @param ILoadBalancer $lb
- * @param IDatabase|array $conn Connection or (server index, group, DatabaseDomain|string)
+ * @param ILoadBalancer $lb Connection manager for $conn
+ * @param Database|array $conn New connection handle or (server index, query groups, domain)
*/
public function __construct( ILoadBalancer $lb, $conn ) {
$this->lb = $lb;
- if ( $conn instanceof IDatabase ) {
+ if ( $conn instanceof Database ) {
$this->conn = $conn; // live handle
} elseif ( count( $conn ) >= 3 && $conn[self::FLD_DOMAIN] !== false ) {
$this->params = $conn;
* Clean up the connection when out of scope
*/
function __destruct() {
- if ( $this->conn !== null ) {
+ if ( $this->conn ) {
$this->lb->reuseConnection( $this->conn );
}
}