11<?php
22
3- declare (strict_types=1 );
4-
53namespace Psr \Http \Message ;
64
75/**
@@ -25,7 +23,7 @@ interface MessageInterface
2523 *
2624 * @return string HTTP protocol version.
2725 */
28- public function getProtocolVersion ();
26+ public function getProtocolVersion (): string ;
2927
3028 /**
3129 * Return an instance with the specified HTTP protocol version.
@@ -40,7 +38,7 @@ public function getProtocolVersion();
4038 * @param string $version HTTP protocol version
4139 * @return static
4240 */
43- public function withProtocolVersion (string $ version );
41+ public function withProtocolVersion (string $ version ): MessageInterface ;
4442
4543 /**
4644 * Retrieves all message header values.
@@ -67,7 +65,7 @@ public function withProtocolVersion(string $version);
6765 * key MUST be a header name, and each value MUST be an array of strings
6866 * for that header.
6967 */
70- public function getHeaders ();
68+ public function getHeaders (): array ;
7169
7270 /**
7371 * Checks if a header exists by the given case-insensitive name.
@@ -77,7 +75,7 @@ public function getHeaders();
7775 * name using a case-insensitive string comparison. Returns false if
7876 * no matching header name is found in the message.
7977 */
80- public function hasHeader (string $ name );
78+ public function hasHeader (string $ name ): bool ;
8179
8280 /**
8381 * Retrieves a message header value by the given case-insensitive name.
@@ -93,7 +91,7 @@ public function hasHeader(string $name);
9391 * header. If the header does not appear in the message, this method MUST
9492 * return an empty array.
9593 */
96- public function getHeader (string $ name );
94+ public function getHeader (string $ name ): array ;
9795
9896 /**
9997 * Retrieves a comma-separated string of the values for a single header.
@@ -114,7 +112,7 @@ public function getHeader(string $name);
114112 * concatenated together using a comma. If the header does not appear in
115113 * the message, this method MUST return an empty string.
116114 */
117- public function getHeaderLine (string $ name );
115+ public function getHeaderLine (string $ name ): string ;
118116
119117 /**
120118 * Return an instance with the provided value replacing the specified header.
@@ -131,7 +129,7 @@ public function getHeaderLine(string $name);
131129 * @return static
132130 * @throws \InvalidArgumentException for invalid header names or values.
133131 */
134- public function withHeader (string $ name , $ value );
132+ public function withHeader (string $ name , $ value ): MessageInterface ;
135133
136134 /**
137135 * Return an instance with the specified header appended with the given value.
@@ -149,7 +147,7 @@ public function withHeader(string $name, $value);
149147 * @return static
150148 * @throws \InvalidArgumentException for invalid header names or values.
151149 */
152- public function withAddedHeader (string $ name , $ value );
150+ public function withAddedHeader (string $ name , $ value ): MessageInterface ;
153151
154152 /**
155153 * Return an instance without the specified header.
@@ -163,14 +161,14 @@ public function withAddedHeader(string $name, $value);
163161 * @param string $name Case-insensitive header field name to remove.
164162 * @return static
165163 */
166- public function withoutHeader (string $ name );
164+ public function withoutHeader (string $ name ): MessageInterface ;
167165
168166 /**
169167 * Gets the body of the message.
170168 *
171169 * @return StreamInterface Returns the body as a stream.
172170 */
173- public function getBody ();
171+ public function getBody (): StreamInterface ;
174172
175173 /**
176174 * Return an instance with the specified message body.
@@ -185,5 +183,5 @@ public function getBody();
185183 * @return static
186184 * @throws \InvalidArgumentException When the body is not valid.
187185 */
188- public function withBody (StreamInterface $ body );
186+ public function withBody (StreamInterface $ body ): MessageInterface ;
189187}
0 commit comments