@@ -536,15 +536,15 @@ public function redirect(string $uri, string $method = 'auto', ?int $code = null
536536 * Accepts an arbitrary number of binds (up to 7) or an associative
537537 * array in the first parameter containing all the values.
538538 *
539- * @param array|string $name Cookie name or array containing binds
540- * @param string $value Cookie value
541- * @param string $expire Cookie expiration time in seconds
542- * @param string $domain Cookie domain (e.g.: '.yourdomain.com')
543- * @param string $path Cookie path (default: '/')
544- * @param string $prefix Cookie name prefix
545- * @param bool $secure Whether to only transfer cookies via SSL
546- * @param bool $httponly Whether only make the cookie accessible via HTTP (no javascript)
547- * @param string|null $samesite
539+ * @param array|Cookie| string $name Cookie name / array containing binds / Cookie object
540+ * @param string $value Cookie value
541+ * @param string $expire Cookie expiration time in seconds
542+ * @param string $domain Cookie domain (e.g.: '.yourdomain.com')
543+ * @param string $path Cookie path (default: '/')
544+ * @param string $prefix Cookie name prefix
545+ * @param bool $secure Whether to only transfer cookies via SSL
546+ * @param bool $httponly Whether only make the cookie accessible via HTTP (no javascript)
547+ * @param string|null $samesite
548548 *
549549 * @return $this
550550 */
@@ -559,6 +559,12 @@ public function setCookie(
559559 $ httponly = false ,
560560 $ samesite = null
561561 ) {
562+ if ($ name instanceof Cookie) {
563+ $ this ->cookieStore = $ this ->cookieStore ->put ($ name );
564+
565+ return $ this ;
566+ }
567+
562568 if (is_array ($ name )) {
563569 // always leave 'name' in last place, as the loop will break otherwise, due to $$item
564570 foreach (['samesite ' , 'value ' , 'expire ' , 'domain ' , 'path ' , 'prefix ' , 'secure ' , 'httponly ' , 'name ' ] as $ item ) {
0 commit comments