@@ -29,13 +29,13 @@ class Cookie
29
29
/**
30
30
* Constructor.
31
31
*
32
- * @param string $name The name of the cookie
33
- * @param string $value The value of the cookie
34
- * @param int|string|\DateTime $expire The time the cookie expires
35
- * @param string $path The path on the server in which the cookie will be available on
36
- * @param string $domain The domain that the cookie is available to
37
- * @param bool $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client
38
- * @param bool $httpOnly Whether the cookie will be made accessible only through the HTTP protocol
32
+ * @param string $name The name of the cookie
33
+ * @param string $value The value of the cookie
34
+ * @param int|string|\DateTime|\DateTimeInterface $expire The time the cookie expires
35
+ * @param string $path The path on the server in which the cookie will be available on
36
+ * @param string $domain The domain that the cookie is available to
37
+ * @param bool $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client
38
+ * @param bool $httpOnly Whether the cookie will be made accessible only through the HTTP protocol
39
39
*
40
40
* @throws \InvalidArgumentException
41
41
*/
@@ -51,7 +51,7 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom
51
51
}
52
52
53
53
// convert expiration time to a Unix timestamp
54
- if ($ expire instanceof \DateTime) {
54
+ if ($ expire instanceof \DateTime || $ expire instanceof \DateTimeInterface ) {
55
55
$ expire = $ expire ->format ('U ' );
56
56
} elseif (!is_numeric ($ expire )) {
57
57
$ expire = strtotime ($ expire );
0 commit comments