Skip to content

Commit a96b04b

Browse files
committed
some methods use real default values instead of nulls (BC break)
1 parent d3e695a commit a96b04b

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/Http/IResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ function setCookie(
397397
?int $expire,
398398
?string $path = null,
399399
?string $domain = null,
400-
?bool $secure = null,
401-
?bool $httpOnly = null,
400+
bool $secure = false,
401+
bool $httpOnly = true,
402402
): static;
403403

404404
/**
@@ -408,6 +408,6 @@ function deleteCookie(
408408
string $name,
409409
?string $path = null,
410410
?string $domain = null,
411-
?bool $secure = null,
411+
bool $secure = false,
412412
);
413413
}

src/Http/Request.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@ class Request implements IRequest
4848

4949
public function __construct(
5050
UrlScript $url,
51-
?array $post = null,
52-
?array $files = null,
53-
?array $cookies = null,
54-
?array $headers = null,
55-
?string $method = null,
51+
array $post = [],
52+
array $files = [],
53+
array $cookies = [],
54+
array $headers = [],
55+
string $method = 'GET',
5656
?string $remoteAddress = null,
5757
?string $remoteHost = null,
5858
?callable $rawBodyCallback = null,
5959
) {
6060
$this->url = $url;
61-
$this->post = (array) $post;
62-
$this->files = (array) $files;
63-
$this->cookies = (array) $cookies;
64-
$this->headers = array_change_key_case((array) $headers, CASE_LOWER);
65-
$this->method = $method ?: 'GET';
61+
$this->post = $post;
62+
$this->files = $files;
63+
$this->cookies = $cookies;
64+
$this->headers = array_change_key_case($headers, CASE_LOWER);
65+
$this->method = $method;
6666
$this->remoteAddress = $remoteAddress;
6767
$this->remoteHost = $remoteHost;
6868
$this->rawBodyCallback = $rawBodyCallback;

src/Http/Response.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ public function setCookie(
250250
?string $path = null,
251251
?string $domain = null,
252252
?bool $secure = null,
253-
?bool $httpOnly = null,
254-
?string $sameSite = null,
253+
bool $httpOnly = true,
254+
string $sameSite = self::SameSiteLax,
255255
): static
256256
{
257257
self::checkHeaders();
@@ -260,8 +260,8 @@ public function setCookie(
260260
'path' => $path ?? ($domain ? '/' : $this->cookiePath),
261261
'domain' => $domain ?? ($path ? '' : $this->cookieDomain),
262262
'secure' => $secure ?? $this->cookieSecure,
263-
'httponly' => $httpOnly ?? true,
264-
'samesite' => $sameSite ?? self::SameSiteLax,
263+
'httponly' => $httpOnly,
264+
'samesite' => $sameSite,
265265
]);
266266
return $this;
267267
}

0 commit comments

Comments
 (0)