From dff7a4ce2be33af5e43be6816dd00f7ee5ac431a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 1 Apr 2021 18:02:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rpc/Consumer.php | 11 ++++++++++- Rpc/IProducer.php | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Rpc/Consumer.php b/Rpc/Consumer.php index b36a114c..78555c77 100644 --- a/Rpc/Consumer.php +++ b/Rpc/Consumer.php @@ -15,7 +15,7 @@ use Snowflake\Snowflake; abstract class Consumer implements IProducer { - + protected ?Client $client = null; @@ -23,6 +23,15 @@ abstract class Consumer implements IProducer public ?Producer $rpc = null; + /** + * @return Client|null + */ + public function initClient(): ?Client + { + return $this->client; + } + + /** * @param string $name * @return mixed diff --git a/Rpc/IProducer.php b/Rpc/IProducer.php index 345a460a..cbe73a0a 100644 --- a/Rpc/IProducer.php +++ b/Rpc/IProducer.php @@ -9,10 +9,10 @@ interface IProducer /** - * @return Client + * @return null|Client * 初始化一个客户端 */ - public function initClient(): Client; + public function initClient(): ?Client; }