1
1
<?php
2
2
3
- declare (strict_types=1 );
4
-
5
3
namespace Psr \Http \Message ;
6
4
7
5
/**
@@ -25,7 +23,7 @@ interface MessageInterface
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.
@@ -40,7 +38,7 @@ public function getProtocolVersion();
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.
@@ -67,7 +65,7 @@ public function withProtocolVersion(string $version);
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.
@@ -77,7 +75,7 @@ public function getHeaders();
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.
@@ -93,7 +91,7 @@ public function hasHeader(string $name);
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.
@@ -114,7 +112,7 @@ public function getHeader(string $name);
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.
@@ -131,7 +129,7 @@ public function getHeaderLine(string $name);
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.
@@ -149,7 +147,7 @@ public function withHeader(string $name, $value);
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.
@@ -163,14 +161,14 @@ public function withAddedHeader(string $name, $value);
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
*
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.
@@ -185,5 +183,5 @@ public function getBody();
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
}
0 commit comments