diff --git a/readme.md b/readme.md index 35fba5d0..7e294c6c 100644 --- a/readme.md +++ b/readme.md @@ -307,7 +307,7 @@ Sets the expiration of the HTTP document using the `Cache-Control` and `Expires` $httpResponse->setExpiration('1 hour'); ``` -setCookie(string $name, string $value, $time, string $path = null, string $domain = null, bool $secure = null, bool $httpOnly = null, string $sameSite = null) +setCookie(string $name, string $value, string|int|\DateTimeInterface|null $expire, string $path = null, string $domain = null, bool $secure = null, bool $httpOnly = null, string $sameSite = null) -------------------------------------------------------------------------------------------------------------------------------------------------------------- Sends a cookie. The default values ​​of the parameters are: - `$path` with scope to all directories (`'/'`) @@ -316,7 +316,7 @@ Sends a cookie. The default values ​​of the parameters are: - `$httpOnly` is true, so the cookie is inaccessible to JavaScript - `$sameSite` is null, so the flag is not specified -The time can be specified as a string or the number of seconds. +The `$expire` parameter can be specified as a string, an object implementing `DateTimeInterface`, or the number of seconds. ```php $httpResponse->setCookie('lang', 'en', '100 days'); diff --git a/src/Http/IResponse.php b/src/Http/IResponse.php index 114af2a8..b71dfe29 100644 --- a/src/Http/IResponse.php +++ b/src/Http/IResponse.php @@ -397,7 +397,7 @@ function getHeaders(): array; function setCookie( string $name, string $value, - ?int $expire, + string|int|\DateTimeInterface|null $expire, ?string $path = null, ?string $domain = null, ?bool $secure = null,