Skip to content

Commit 30f2d97

Browse files
committed
Remove return types for several classes to make testing easier.
1 parent 9c5d696 commit 30f2d97

4 files changed

Lines changed: 32 additions & 30 deletions

File tree

system/HTTP/Message.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function getBody()
9898
*
9999
* @return Message
100100
*/
101-
public function setBody(&$data): self
101+
public function setBody(&$data)
102102
{
103103
$this->body = $data;
104104

@@ -114,7 +114,7 @@ public function setBody(&$data): self
114114
*
115115
* @return \CodeIgniter\HTTP\Message
116116
*/
117-
public function appendBody($data): self
117+
public function appendBody($data)
118118
{
119119
$this->body .= (string)$data;
120120

@@ -271,7 +271,7 @@ public function getHeaderLine(string $name): string
271271
*
272272
* @return Message
273273
*/
274-
public function setHeader(string $name, $value): self
274+
public function setHeader(string $name, $value)
275275
{
276276
if (! isset($this->headers[$name]))
277277
{
@@ -301,7 +301,7 @@ public function setHeader(string $name, $value): self
301301
*
302302
* @return Message
303303
*/
304-
public function removeHeader(string $name): self
304+
public function removeHeader(string $name)
305305
{
306306
$orig_name = $this->getHeaderName($name);
307307

@@ -322,7 +322,7 @@ public function removeHeader(string $name): self
322322
*
323323
* @return string
324324
*/
325-
public function appendHeader(string $name, $value): self
325+
public function appendHeader(string $name, $value)
326326
{
327327
$orig_name = $this->getHeaderName($name);
328328

@@ -342,7 +342,7 @@ public function appendHeader(string $name, $value): self
342342
*
343343
* @return string
344344
*/
345-
public function prependHeader(string $name, $value): self
345+
public function prependHeader(string $name, $value)
346346
{
347347
$orig_name = $this->getHeaderName($name);
348348

@@ -372,7 +372,7 @@ public function getProtocolVersion(): string
372372
*
373373
* @return Message
374374
*/
375-
public function setProtocolVersion(string $version): self
375+
public function setProtocolVersion(string $version)
376376
{
377377
if (! is_numeric($version))
378378
{

system/HTTP/Response.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public function getStatusCode(): int
272272
* @return self
273273
* @throws \InvalidArgumentException For invalid status code arguments.
274274
*/
275-
public function setStatusCode(int $code, string $reason = ''): self
275+
public function setStatusCode(int $code, string $reason = '')
276276
{
277277
// Valid range?
278278
if ($code < 100 || $code > 599)
@@ -335,7 +335,7 @@ public function getReason(): string
335335
*
336336
* @return Response
337337
*/
338-
public function setDate(\DateTime $date): self
338+
public function setDate(\DateTime $date)
339339
{
340340
$date->setTimezone(new \DateTimeZone('UTC'));
341341

@@ -355,7 +355,7 @@ public function setDate(\DateTime $date): self
355355
*
356356
* @return Response
357357
*/
358-
public function setContentType(string $mime, string $charset = 'UTF-8'): self
358+
public function setContentType(string $mime, string $charset = 'UTF-8')
359359
{
360360
if (! empty($charset))
361361
{
@@ -419,7 +419,7 @@ public function noCache(): self
419419
*
420420
* @return $this
421421
*/
422-
public function setCache(array $options = []): self
422+
public function setCache(array $options = [])
423423
{
424424
if (empty($options))
425425
{
@@ -459,7 +459,7 @@ public function setCache(array $options = []): self
459459
*
460460
* @param $date
461461
*/
462-
public function setLastModified($date): self
462+
public function setLastModified($date)
463463
{
464464
if ($date instanceof \DateTime)
465465
{
@@ -486,7 +486,7 @@ public function setLastModified($date): self
486486
*
487487
* @return Response
488488
*/
489-
public function send(): self
489+
public function send()
490490
{
491491
// If we're enforcing a Content Security Policy,
492492
// we need to give it a chance to build out it's headers.
@@ -508,7 +508,7 @@ public function send(): self
508508
*
509509
* @return Response
510510
*/
511-
public function sendHeaders(): self
511+
public function sendHeaders()
512512
{
513513
// Have the headers already been sent?
514514
if (headers_sent())
@@ -551,13 +551,15 @@ public function sendBody()
551551

552552
//--------------------------------------------------------------------
553553

554-
/**
555-
* Perform a redirect to a new URL, in two flavors: header or location.
556-
*
557-
* @param string $uri The URI to redirect to
558-
* @param string $method
559-
* @param int $code The type of redirection, defaults to 302
560-
*/
554+
/**
555+
* Perform a redirect to a new URL, in two flavors: header or location.
556+
*
557+
* @param string $uri The URI to redirect to
558+
* @param string $method
559+
* @param int $code The type of redirection, defaults to 302
560+
*
561+
* @throws \CodeIgniter\HTTP\RedirectException
562+
*/
561563
public function redirect(string $uri, string $method = 'auto', int $code = null)
562564
{
563565
// IIS environment likely? Use 'refresh' for better compatibility

system/HTTP/ResponseInterface.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ interface ResponseInterface
5555
{
5656

5757
/**
58-
* Constants for status codes.
58+
* Constants for status codes.
5959
* From https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
6060
*/
6161
// Informational
@@ -141,7 +141,7 @@ public function getStatusCode(): int;
141141
* @return self
142142
* @throws \InvalidArgumentException For invalid status code arguments.
143143
*/
144-
public function setStatusCode(int $code, string $reason = ''): Response;
144+
public function setStatusCode(int $code, string $reason = '');
145145

146146
//--------------------------------------------------------------------
147147

@@ -167,7 +167,7 @@ public function getReason(): string;
167167
*
168168
* @return Response
169169
*/
170-
public function setDate(\DateTime $date): Response;
170+
public function setDate(\DateTime $date);
171171

172172
//--------------------------------------------------------------------
173173

@@ -180,7 +180,7 @@ public function setDate(\DateTime $date): Response;
180180
*
181181
* @return Response
182182
*/
183-
public function setContentType(string $mime, string $charset = 'UTF-8'): Response;
183+
public function setContentType(string $mime, string $charset = 'UTF-8');
184184

185185
//--------------------------------------------------------------------
186186
//--------------------------------------------------------------------
@@ -193,7 +193,7 @@ public function setContentType(string $mime, string $charset = 'UTF-8'): Respons
193193
* Sets the appropriate headers to ensure this response
194194
* is not cached by the browsers.
195195
*/
196-
public function noCache(): Response;
196+
public function noCache();
197197

198198
//--------------------------------------------------------------------
199199

@@ -225,7 +225,7 @@ public function noCache(): Response;
225225
*
226226
* @return $this
227227
*/
228-
public function setCache(array $options = []): Response;
228+
public function setCache(array $options = []);
229229

230230
//--------------------------------------------------------------------
231231

@@ -237,7 +237,7 @@ public function setCache(array $options = []): Response;
237237
*
238238
* @param $date
239239
*/
240-
public function setLastModified($date): Response;
240+
public function setLastModified($date);
241241

242242
//--------------------------------------------------------------------
243243
//--------------------------------------------------------------------
@@ -249,7 +249,7 @@ public function setLastModified($date): Response;
249249
*
250250
* @return Response
251251
*/
252-
public function send(): Response;
252+
public function send();
253253

254254
//--------------------------------------------------------------------
255255
}

system/Model.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ public function __get(string $name)
11721172
*
11731173
* @return $this|null
11741174
*/
1175-
public function __call(string $name, array $params)
1175+
public function __call($name, array $params)
11761176
{
11771177
$result = null;
11781178

0 commit comments

Comments
 (0)