@@ -24,7 +24,7 @@ class Message implements MessageInterface
2424 protected $ request ;
2525
2626 /**
27- * @var string $httpVersion
27+ * @var string|null $httpVersion
2828 */
2929 protected $ httpVersion ;
3030
@@ -54,7 +54,7 @@ class Message implements MessageInterface
5454 */
5555 public function __construct (
5656 HttpRequest $ request ,
57- string $ httpVersion = null ,
57+ ? string $ httpVersion = null ,
5858 $ body = null ,
5959 array $ attributes = []
6060 ) {
@@ -129,11 +129,11 @@ public function getHeader($name)
129129 public function getHeaderLine ($ name )
130130 {
131131 $ value = $ this ->getHeader ($ name );
132- if (empty ($ value )) {
132+ if (count ($ value ) === 0 ) {
133133 return '' ;
134134 }
135135
136- return implode (', ' , ( array ) $ value );
136+ return implode (', ' , $ value );
137137 }
138138
139139 /**
@@ -143,6 +143,7 @@ public function withHeader($name, $value)
143143 {
144144 $ newRequest = $ this ->getClonedRequest ();
145145 $ newRequest ->getHeaders ()->add ($ name , $ value );
146+
146147 return new static ($ newRequest , $ this ->httpVersion , $ this ->body , $ this ->attributes );
147148 }
148149
@@ -200,6 +201,14 @@ public function withBody(StreamInterface $body)
200201 return new static ($ this ->request , $ this ->httpVersion , $ body , $ this ->attributes );
201202 }
202203
204+ /**
205+ * @return HttpRequest
206+ */
207+ protected function getClonedRequest ()
208+ {
209+ return clone $ this ->request ;
210+ }
211+
203212 /**
204213 * @param HttpRequest $request Битриксовый Request.
205214 *
0 commit comments