Skip to content

Commit 176d830

Browse files
committed
Add type hints to methods in AbstractMessage class
1 parent 0e4519e commit 176d830

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/Io/AbstractMessage.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ protected function __construct($protocolVersion, array $headers, StreamInterface
6565
$this->body = $body;
6666
}
6767

68-
public function getProtocolVersion()
68+
public function getProtocolVersion(): string
6969
{
7070
return $this->protocolVersion;
7171
}
7272

73-
public function withProtocolVersion($version)
73+
public function withProtocolVersion(string $version): MessageInterface
7474
{
7575
if ((string) $version === $this->protocolVersion) {
7676
return $this;
@@ -82,28 +82,28 @@ public function withProtocolVersion($version)
8282
return $message;
8383
}
8484

85-
public function getHeaders()
85+
public function getHeaders(): array
8686
{
8787
return $this->headers;
8888
}
8989

90-
public function hasHeader($name)
90+
public function hasHeader(string $name): bool
9191
{
9292
return isset($this->headerNamesLowerCase[\strtolower($name)]);
9393
}
9494

95-
public function getHeader($name)
95+
public function getHeader(string $name): array
9696
{
9797
$lower = \strtolower($name);
9898
return isset($this->headerNamesLowerCase[$lower]) ? $this->headers[$this->headerNamesLowerCase[$lower]] : [];
9999
}
100100

101-
public function getHeaderLine($name)
101+
public function getHeaderLine(string $name): string
102102
{
103103
return \implode(', ', $this->getHeader($name));
104104
}
105105

106-
public function withHeader($name, $value)
106+
public function withHeader(string $name, $value): MessageInterface
107107
{
108108
if ($value === []) {
109109
return $this->withoutHeader($name);
@@ -131,7 +131,7 @@ public function withHeader($name, $value)
131131
return $message;
132132
}
133133

134-
public function withAddedHeader($name, $value)
134+
public function withAddedHeader(string $name, $value): MessageInterface
135135
{
136136
if ($value === []) {
137137
return $this;
@@ -140,7 +140,7 @@ public function withAddedHeader($name, $value)
140140
return $this->withHeader($name, \array_merge($this->getHeader($name), \is_array($value) ? $value : [$value]));
141141
}
142142

143-
public function withoutHeader($name)
143+
public function withoutHeader(string $name): MessageInterface
144144
{
145145
$lower = \strtolower($name);
146146
if (!isset($this->headerNamesLowerCase[$lower])) {
@@ -153,12 +153,12 @@ public function withoutHeader($name)
153153
return $message;
154154
}
155155

156-
public function getBody()
156+
public function getBody(): StreamInterface
157157
{
158158
return $this->body;
159159
}
160160

161-
public function withBody(StreamInterface $body)
161+
public function withBody(StreamInterface $body): MessageInterface
162162
{
163163
if ($body === $this->body) {
164164
return $this;

0 commit comments

Comments
 (0)