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; }