@@ -536,15 +536,15 @@ public function redirect(string $uri, string $method = 'auto', ?int $code = null
536
536
* Accepts an arbitrary number of binds (up to 7) or an associative
537
537
* array in the first parameter containing all the values.
538
538
*
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
548
548
*
549
549
* @return $this
550
550
*/
@@ -559,6 +559,12 @@ public function setCookie(
559
559
$ httponly = false ,
560
560
$ samesite = null
561
561
) {
562
+ if ($ name instanceof Cookie) {
563
+ $ this ->cookieStore = $ this ->cookieStore ->put ($ name );
564
+
565
+ return $ this ;
566
+ }
567
+
562
568
if (is_array ($ name )) {
563
569
// always leave 'name' in last place, as the loop will break otherwise, due to $$item
564
570
foreach (['samesite ' , 'value ' , 'expire ' , 'domain ' , 'path ' , 'prefix ' , 'secure ' , 'httponly ' , 'name ' ] as $ item ) {
0 commit comments