Skip to content

Commit d262bd5

Browse files
authored
Fix instance returned by MessageResponseTrait
1 parent 603d87e commit d262bd5

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/Traits/MessageResponseTrait.php

+19-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public function getProtocolVersion(): string
3131

3232
public function withProtocolVersion($version): MessageInterface
3333
{
34-
return $this->response->withProtocolVersion($version);
34+
$this->response->withProtocolVersion($version);
35+
36+
return $this;
3537
}
3638

3739
public function getHeaders(): array
@@ -56,17 +58,23 @@ public function getHeaderLine(string $name): string
5658

5759
public function withHeader(string $name, $value): MessageInterface
5860
{
59-
return $this->response->withHeader($name, $value);
61+
$this->response->withHeader($name, $value);
62+
63+
return $this;
6064
}
6165

6266
public function withAddedHeader(string $name, $value): MessageInterface
6367
{
64-
return $this->response->withAddedHeader($name, $value);
68+
$this->response->withAddedHeader($name, $value);
69+
70+
return $this;
6571
}
6672

6773
public function withoutHeader(string $name): MessageInterface
6874
{
69-
return $this->response->withoutHeader($name);
75+
$this->response->withoutHeader($name);
76+
77+
return $this;
7078
}
7179

7280
public function getBody(): StreamInterface
@@ -76,7 +84,9 @@ public function getBody(): StreamInterface
7684

7785
public function withBody(StreamInterface $body): MessageInterface
7886
{
79-
return $this->response->withBody($body);
87+
$this->response->withBody($body);
88+
89+
return $this;
8090
}
8191

8292
public function getStatusCode(): int
@@ -86,11 +96,13 @@ public function getStatusCode(): int
8696

8797
public function withStatus(int $code, string $reasonPhrase = ''): ResponseInterface
8898
{
89-
return $this->response->withStatus($code, $reasonPhrase);
99+
$this->response->withStatus($code, $reasonPhrase);
100+
101+
return $this;
90102
}
91103

92104
public function getReasonPhrase(): string
93105
{
94106
return $this->response->getReasonPhrase();
95107
}
96-
}
108+
}

0 commit comments

Comments
 (0)