src/Http/Formatting/ResponseHeaderFormatter.php
public function deleteCookie(
        HttpHeaders $headers,
        string $name,
        ?string $path = null,
        ?string $domain = null,
        bool $isSecure = false,
        bool $isHttpOnly = true,
        ?string $sameSite = null
    ): void {
        $headerValue = "$name=";
        $expiration = DateTime::createFromFormat('U', '0');
        $headerValue .= "; Expires={$expiration->format(self::EXPIRATION_DATE_FORMAT)}";
        $headerValue .= '; Max-Age=0';

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

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

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

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

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

        $headers->add('Set-Cookie', $headerValue, true);
    }
public function deleteCookie(
        HttpHeaders $headers,
        string $name,
        ?string $path = null,
        ?string $domain = null,
        bool $isSecure = false,
        bool $isHttpOnly = true,
        ?string $sameSite = null
    ): void {
        $headerValue = "$name=";
        $expiration = DateTime::createFromFormat('U', '0');
        $headerValue .= "; Expires={$expiration->format(self::EXPIRATION_DATE_FORMAT)}";
        $headerValue .= '; Max-Age=0';

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

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

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

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

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

        $headers->add('Set-Cookie', $headerValue, true);
    }
Deletes a cookie from headers

@param HttpHeaders $headers The headers to format
@param string $name The name of the cookie to delete
@param string|null $path The path to the cookie to delete if set, otherwise null
@param string|null $domain The domain of the cookie to delete if set, otherwise null
@param bool $isSecure Whether or not the cookie to be deleted was HTTPS
@param bool $isHttpOnly Whether or not the cookie to be deleted was HTTP-only
@param string|null $sameSite The same-site setting to use if set, otherwise null
@throws RuntimeException Thrown if the set cookie header's hash key could not be calculated