| @@ -1,8 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); | |
| 4 | - | |
| 5 | 3 | namespace Psr\Http\Message; |
| 6 | 4 | |
| 7 | 5 | /** |
| 8 | 6 | * HTTP messages consist of requests from a client to a server and responses |
| @@ -24,9 +22,9 @@ | ||
| 24 | 22 | * The string MUST contain only the HTTP version number (e.g., "1.1", "1.0"). |
| 25 | 23 | * |
| 26 | 24 | * @return string HTTP protocol version. |
| 27 | 25 | */ |
| 28 | - public function getProtocolVersion(); | |
| 26 | + public function getProtocolVersion(): string; | |
| 29 | 27 | |
| 30 | 28 | /** |
| 31 | 29 | * Return an instance with the specified HTTP protocol version. |
| 32 | 30 | * |
| @@ -39,9 +37,9 @@ | ||
| 39 | 37 | * |
| 40 | 38 | * @param string $version HTTP protocol version |
| 41 | 39 | * @return static |
| 42 | 40 | */ |
| 43 | - public function withProtocolVersion(string $version); | |
| 41 | + public function withProtocolVersion(string $version): MessageInterface; | |
| 44 | 42 | |
| 45 | 43 | /** |
| 46 | 44 | * Retrieves all message header values. |
| 47 | 45 | * |
| @@ -66,9 +64,9 @@ | ||
| 66 | 64 | * @return string[][] Returns an associative array of the message's headers. Each |
| 67 | 65 | * key MUST be a header name, and each value MUST be an array of strings |
| 68 | 66 | * for that header. |
| 69 | 67 | */ |
| 70 | - public function getHeaders(); | |
| 68 | + public function getHeaders(): array; | |
| 71 | 69 | |
| 72 | 70 | /** |
| 73 | 71 | * Checks if a header exists by the given case-insensitive name. |
| 74 | 72 | * |
| @@ -76,9 +74,9 @@ | ||
| 76 | 74 | * @return bool Returns true if any header names match the given header |
| 77 | 75 | * name using a case-insensitive string comparison. Returns false if |
| 78 | 76 | * no matching header name is found in the message. |
| 79 | 77 | */ |
| 80 | - public function hasHeader(string $name); | |
| 78 | + public function hasHeader(string $name): bool; | |
| 81 | 79 | |
| 82 | 80 | /** |
| 83 | 81 | * Retrieves a message header value by the given case-insensitive name. |
| 84 | 82 | * |
| @@ -92,9 +90,9 @@ | ||
| 92 | 90 | * @return string[] An array of string values as provided for the given |
| 93 | 91 | * header. If the header does not appear in the message, this method MUST |
| 94 | 92 | * return an empty array. |
| 95 | 93 | */ |
| 96 | - public function getHeader(string $name); | |
| 94 | + public function getHeader(string $name): array; | |
| 97 | 95 | |
| 98 | 96 | /** |
| 99 | 97 | * Retrieves a comma-separated string of the values for a single header. |
| 100 | 98 | * |
| @@ -113,9 +111,9 @@ | ||
| 113 | 111 | * @return string A string of values as provided for the given header |
| 114 | 112 | * concatenated together using a comma. If the header does not appear in |
| 115 | 113 | * the message, this method MUST return an empty string. |
| 116 | 114 | */ |
| 117 | - public function getHeaderLine(string $name); | |
| 115 | + public function getHeaderLine(string $name): string; | |
| 118 | 116 | |
| 119 | 117 | /** |
| 120 | 118 | * Return an instance with the provided value replacing the specified header. |
| 121 | 119 | * |
| @@ -130,9 +128,9 @@ | ||
| 130 | 128 | * @param string|string[] $value Header value(s). |
| 131 | 129 | * @return static |
| 132 | 130 | * @throws \InvalidArgumentException for invalid header names or values. |
| 133 | 131 | */ |
| 134 | - public function withHeader(string $name, $value); | |
| 132 | + public function withHeader(string $name, $value): MessageInterface; | |
| 135 | 133 | |
| 136 | 134 | /** |
| 137 | 135 | * Return an instance with the specified header appended with the given value. |
| 138 | 136 | * |
| @@ -148,9 +146,9 @@ | ||
| 148 | 146 | * @param string|string[] $value Header value(s). |
| 149 | 147 | * @return static |
| 150 | 148 | * @throws \InvalidArgumentException for invalid header names or values. |
| 151 | 149 | */ |
| 152 | - public function withAddedHeader(string $name, $value); | |
| 150 | + public function withAddedHeader(string $name, $value): MessageInterface; | |
| 153 | 151 | |
| 154 | 152 | /** |
| 155 | 153 | * Return an instance without the specified header. |
| 156 | 154 | * |
| @@ -162,9 +160,9 @@ | ||
| 162 | 160 | * |
| 163 | 161 | * @param string $name Case-insensitive header field name to remove. |
| 164 | 162 | * @return static |
| 165 | 163 | */ |
| 166 | - public function withoutHeader(string $name); | |
| 164 | + public function withoutHeader(string $name): MessageInterface; | |
| 167 | 165 | |
| 168 | 166 | /** |
| 169 | 167 | * Gets the body of the message. |
| 170 | 168 | * |
| @@ -169,9 +167,9 @@ | ||
| 169 | 167 | * Gets the body of the message. |
| 170 | 168 | * |
| 171 | 169 | * @return StreamInterface Returns the body as a stream. |
| 172 | 170 | */ |
| 173 | - public function getBody(); | |
| 171 | + public function getBody(): StreamInterface; | |
| 174 | 172 | |
| 175 | 173 | /** |
| 176 | 174 | * Return an instance with the specified message body. |
| 177 | 175 | * |
| @@ -184,6 +182,6 @@ | ||
| 184 | 182 | * @param StreamInterface $body Body. |
| 185 | 183 | * @return static |
| 186 | 184 | * @throws \InvalidArgumentException When the body is not valid. |
| 187 | 185 | */ |
| 188 | - public function withBody(StreamInterface $body); | |
| 186 | + public function withBody(StreamInterface $body): MessageInterface; | |
| 189 | 187 | } |