src/Http/Formatting/ResponseHeaderFormatter.php
private function getSetCookieHeaderValue(Cookie $cookie): string
    {
        $headerValue = "{$cookie->getName()}=" . urlencode($cookie->getValue());

        if (($expiration = $cookie->getExpiration()) !== null) {
            $headerValue .= '; Expires=' . $expiration->format(self::EXPIRATION_DATE_FORMAT);
        }

        if (($maxAge = $cookie->getMaxAge()) !== null) {
            $headerValue .= "; Max-Age=$maxAge";
        }

        if (($domain = $cookie->getDomain()) !== null) {
            $headerValue .= '; Domain=' . urlencode($domain);
        }

        if (($path = $cookie->getPath()) !== null) {
            $headerValue .= '; Path=' . urlencode($path);
        }

        if ($cookie->isSecure()) {
            $headerValue .= '; Secure';
        }

        if ($cookie->isHttpOnly()) {
            $headerValue .= '; HttpOnly';
        }

        if (($sameSite = $cookie->getSameSite()) !== null) {
            $headerValue .= '; SameSite=' . urlencode($sameSite);
        }

        return $headerValue;
    }
private function getSetCookieHeaderValue(Cookie $cookie): string
    {
        $headerValue = "{$cookie->getName()}=" . urlencode($cookie->getValue());

        if (($expiration = $cookie->getExpiration()) !== null) {
            $headerValue .= '; Expires=' . $expiration->format(self::EXPIRATION_DATE_FORMAT);
        }

        if (($maxAge = $cookie->getMaxAge()) !== null) {
            $headerValue .= "; Max-Age=$maxAge";
        }

        if (($domain = $cookie->getDomain()) !== null) {
            $headerValue .= '; Domain=' . urlencode($domain);
        }

        if (($path = $cookie->getPath()) !== null) {
            $headerValue .= '; Path=' . urlencode($path);
        }

        if ($cookie->isSecure()) {
            $headerValue .= '; Secure';
        }

        if ($cookie->isHttpOnly()) {
            $headerValue .= '; HttpOnly';
        }

        if (($sameSite = $cookie->getSameSite()) !== null) {
            $headerValue .= '; SameSite=' . urlencode($sameSite);
        }

        return $headerValue;
    }
Gets the set-cookie header value from a cookie

@param Cookie $cookie The cookie to serialize
@return string The set-cookie header value