From 1bc74de8455014fdff26a20c3cf2f2913a4229f7 Mon Sep 17 00:00:00 2001 From: Demin Yin Date: Mon, 5 Feb 2024 14:03:35 -0800 Subject: [PATCH] enhance type hinting for \Swoole\FastCGI\Message::withBody() method (#165) --- src/core/FastCGI/HttpResponse.php | 2 +- src/core/FastCGI/Message.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/FastCGI/HttpResponse.php b/src/core/FastCGI/HttpResponse.php index db4fd26..8765c3b 100644 --- a/src/core/FastCGI/HttpResponse.php +++ b/src/core/FastCGI/HttpResponse.php @@ -33,7 +33,7 @@ class HttpResponse extends Response public function __construct(array $records = []) { parent::__construct($records); - $body = (string) $this->getBody(); + $body = $this->getBody(); if (strlen($body) === 0) { return; } diff --git a/src/core/FastCGI/Message.php b/src/core/FastCGI/Message.php index 745f03c..6d299c0 100644 --- a/src/core/FastCGI/Message.php +++ b/src/core/FastCGI/Message.php @@ -58,7 +58,7 @@ public function getBody(): string return $this->body; } - public function withBody($body): self + public function withBody(string|\Stringable $body): self { $this->body = (string) $body; return $this;