Skip to content

Commit 6bd60df

Browse files
committed
Updated MessageResponseTrait with PSR-7 v2.0 interfaces
1 parent 47f313b commit 6bd60df

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/Traits/MessageResponseTrait.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
namespace Elastic\Elasticsearch\Traits;
1616

17+
use Psr\Http\Message\MessageInterface;
18+
use Psr\Http\Message\ResponseInterface;
1719
use Psr\Http\Message\StreamInterface;
1820

1921
/**
@@ -22,72 +24,72 @@
2224
*/
2325
trait MessageResponseTrait
2426
{
25-
public function getProtocolVersion()
27+
public function getProtocolVersion(): string
2628
{
2729
return $this->response->getProtocolVersion();
2830
}
2931

30-
public function withProtocolVersion($version)
32+
public function withProtocolVersion($version): MessageInterface
3133
{
3234
return $this->response->withProtocolVersion($version);
3335
}
3436

35-
public function getHeaders()
37+
public function getHeaders(): array
3638
{
3739
return $this->response->getHeaders();
3840
}
3941

40-
public function hasHeader($name)
42+
public function hasHeader(string $name): bool
4143
{
4244
return $this->response->hasHeader($name);
4345
}
4446

45-
public function getHeader($name)
47+
public function getHeader(string $name): array
4648
{
4749
return $this->response->getHeader($name);
4850
}
4951

50-
public function getHeaderLine($name)
52+
public function getHeaderLine(string $name): string
5153
{
5254
return $this->response->getHeaderLine($name);
5355
}
5456

55-
public function withHeader($name, $value)
57+
public function withHeader(string $name, $value): MessageInterface
5658
{
5759
return $this->response->withHeader($name, $value);
5860
}
5961

60-
public function withAddedHeader($name, $value)
62+
public function withAddedHeader(string $name, $value): MessageInterface
6163
{
6264
return $this->response->withAddedHeader($name, $value);
6365
}
6466

65-
public function withoutHeader($name)
67+
public function withoutHeader(string $name): MessageInterface
6668
{
6769
return $this->response->withoutHeader($name);
6870
}
6971

70-
public function getBody()
72+
public function getBody(): StreamInterface
7173
{
7274
return $this->response->getBody();
7375
}
7476

75-
public function withBody(StreamInterface $body)
77+
public function withBody(StreamInterface $body): MessageInterface
7678
{
7779
return $this->response->withBody($body);
7880
}
7981

80-
public function getStatusCode()
82+
public function getStatusCode(): int
8183
{
8284
return $this->response->getStatusCode();
8385
}
8486

85-
public function withStatus($code, $reasonPhrase = '')
87+
public function withStatus(int $code, string $reasonPhrase = ''): ResponseInterface
8688
{
8789
return $this->response->withStatus($code, $reasonPhrase);
8890
}
8991

90-
public function getReasonPhrase()
92+
public function getReasonPhrase(): string
9193
{
9294
return $this->response->getReasonPhrase();
9395
}

0 commit comments

Comments
 (0)