From 582583cd3254b96e333e049a1d2588f17b6e6237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Wed, 5 Apr 2023 22:09:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Connection.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Connection.php b/Connection.php index 330fd6a..a59ddb3 100644 --- a/Connection.php +++ b/Connection.php @@ -155,11 +155,10 @@ class Connection extends Component */ public function getMasterClient(): PDO { - $client = $this->connection->get($this->cds); - if ($client === false) { - throw new Exception('waite db client timeout.'); + if (($client = $this->connection->get($this->cds)) instanceof PDO) { + return $client; } - return $client; + throw new Exception('waite db client timeout.'); } /**