<commit_before>// @flow

declare module '@sentry/browser' {
    declare export function addGlobalEventProcessor(callback: EventProcessor): void;
    declare export function addBreadcrumb(breadcrumb: Breadcrumb): void;
    declare export function captureException(
        message: mixed,
        severity?: $Values<typeof Severity>,
    ): void;
    declare export function captureMessage(
        message: mixed,
        severity?: $Values<typeof Severity>,
    ): void;
    declare export function configureScope((Scope) => void): void;
    declare export function getCurrentHub(): Hub;
    declare export function getHubFromCarrier(carrier: Carrier): Hub;

    declare export class Hub {
        constructor(client: BrowserClient<Options>): Hub;
        isOlderThan(version: number): boolean;
        bindClient(client?: BrowserClient<Options>): void;
        pushScope(): Scope;
        popScope(): boolean;
        withScope(callback: (scope: Scope) => void): void;
        getClient(): BrowserClient<Options> | void;
        captureException(exception: mixed, hint?: EventHint): string;
        captureMessage(message: string, level?: $Values<typeof Severity>, hint?: EventHint): string;
        captureEvent(event: Event, hint?: EventHint): string;
        lastEventId(): string | void;
        addBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void;
        setUser(user: User | null): void;
        setTags(tags: { [key: string]: string, ... }): void;
        setTag(key: string, value: string): void;
        setExtra(key: string, extra: any): void;
        setExtras(extras: { [key: string]: any, ... }): void;
        setContext(name: string, context: { [key: string]: mixed, ... } | null): void;
        configureScope(callback: (scope: Scope) => void): void;
        run(callback: (hub: Hub) => void): void;
        getIntegration<T>(integration: Class<Integration<T>>): Integration<T> | null;
        traceHeaders(): { [key: string]: string, ... };
        startSpan(span?: Span | SpanContext, forceNoChild?: boolean): Span;
    }

    declare export class Scope {
        addEventProcessor(callback: EventProcessor): void;
        setUser(user: User | null): void;
        setTags(tags: {| [key: string]: string |}): void;
        setTag(key: string, value: string): void;
        setExtras(extras: { [key: string]: any, ... }): void;
        setExtra(key: string, extra: any): void;
        setFingerprint(fingerprint: $ReadOnlyArray<string>): void;
        setLevel(level: $Values<typeof Severity>): void;
        setTransaction(transaction?: string): void;
        setContext(name: string, context: {| [key: string]: mixed |}): void;
        setSpan(span?: Span): void;
        clear(): void;
        addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): void;
        clearBreadcrumbs(): void;
    }

    declare export function setContext(
        name: string,
        context: {| [key: string]: mixed |} | null,
    ): void;
    declare export function setExtra(key: string, extra: any): void;
    declare export function setExtras(extras: { [key: string]: any, ... }): void;
    declare export function setTag(key: string, value: string): void;
    declare export function setTags(tags: {| [key: string]: string |}): void;
    declare export function setUser(user: User): void;
    declare export function withScope(callback: (scope: Scope) => void): void;

    declare export class BrowserClient<O: Options = Options> {
        constructor(options: O): BrowserClient<O>;
        captureException(exception: mixed, hint?: EventHint, scope?: Scope): string | void;
        captureMessage(
            message: string,
            level?: $Values<typeof Severity>,
            hint?: EventHint,
            scope?: Scope,
        ): string | void;
        captureEvent(event: SentryEvent, hint?: EventHint, scope?: Scope): string | void;
        getDsn(): Dsn | void;
        getOptions(): O;
        close(timeout?: number): Promise<boolean>;
        flush(timeout?: number): Promise<boolean>;
        getIntegration<T>(integration: Class<Integration<T>>): Integration<T> | null;
    }
<commit_msg>Allow @sentry/browser setUser to accept null (#3811)<commit_after>// @flow

declare module '@sentry/browser' {
    declare export function addGlobalEventProcessor(callback: EventProcessor): void;
    declare export function addBreadcrumb(breadcrumb: Breadcrumb): void;
    declare export function captureException(
        message: mixed,
        severity?: $Values<typeof Severity>,
    ): void;
    declare export function captureMessage(
        message: mixed,
        severity?: $Values<typeof Severity>,
    ): void;
    declare export function configureScope((Scope) => void): void;
    declare export function getCurrentHub(): Hub;
    declare export function getHubFromCarrier(carrier: Carrier): Hub;

    declare export class Hub {
        constructor(client: BrowserClient<Options>): Hub;
        isOlderThan(version: number): boolean;
        bindClient(client?: BrowserClient<Options>): void;
        pushScope(): Scope;
        popScope(): boolean;
        withScope(callback: (scope: Scope) => void): void;
        getClient(): BrowserClient<Options> | void;
        captureException(exception: mixed, hint?: EventHint): string;
        captureMessage(message: string, level?: $Values<typeof Severity>, hint?: EventHint): string;
        captureEvent(event: Event, hint?: EventHint): string;
        lastEventId(): string | void;
        addBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void;
        setUser(user: User | null): void;
        setTags(tags: { [key: string]: string, ... }): void;
        setTag(key: string, value: string): void;
        setExtra(key: string, extra: any): void;
        setExtras(extras: { [key: string]: any, ... }): void;
        setContext(name: string, context: { [key: string]: mixed, ... } | null): void;
        configureScope(callback: (scope: Scope) => void): void;
        run(callback: (hub: Hub) => void): void;
        getIntegration<T>(integration: Class<Integration<T>>): Integration<T> | null;
        traceHeaders(): { [key: string]: string, ... };
        startSpan(span?: Span | SpanContext, forceNoChild?: boolean): Span;
    }

    declare export class Scope {
        addEventProcessor(callback: EventProcessor): void;
        setUser(user: User | null): void;
        setTags(tags: {| [key: string]: string |}): void;
        setTag(key: string, value: string): void;
        setExtras(extras: { [key: string]: any, ... }): void;
        setExtra(key: string, extra: any): void;
        setFingerprint(fingerprint: $ReadOnlyArray<string>): void;
        setLevel(level: $Values<typeof Severity>): void;
        setTransaction(transaction?: string): void;
        setContext(name: string, context: {| [key: string]: mixed |}): void;
        setSpan(span?: Span): void;
        clear(): void;
        addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): void;
        clearBreadcrumbs(): void;
    }

    declare export function setContext(
        name: string,
        context: {| [key: string]: mixed |} | null,
    ): void;
    declare export function setExtra(key: string, extra: any): void;
    declare export function setExtras(extras: { [key: string]: any, ... }): void;
    declare export function setTag(key: string, value: string): void;
    declare export function setTags(tags: {| [key: string]: string |}): void;
    declare export function setUser(user: User | null): void;
    declare export function withScope(callback: (scope: Scope) => void): void;

    declare export class BrowserClient<O: Options = Options> {
        constructor(options: O): BrowserClient<O>;
        captureException(exception: mixed, hint?: EventHint, scope?: Scope): string | void;
        captureMessage(
            message: string,
            level?: $Values<typeof Severity>,
            hint?: EventHint,
            scope?: Scope,
        ): string | void;
        captureEvent(event: SentryEvent, hint?: EventHint, scope?: Scope): string | void;
        getDsn(): Dsn | void;
        getOptions(): O;
        close(timeout?: number): Promise<boolean>;
        flush(timeout?: number): Promise<boolean>;
        getIntegration<T>(integration: Class<Integration<T>>): Integration<T> | null;
    }

{'fraction_non_alphanumeric': 0.13538166106577051, 'fraction_numerical': 0.00048007681228996637, 'mean_word_length': 3.2428716904276986, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6721649', 'n_tokens_mistral': 2338, 'n_tokens_neox': 2307, 'n_words': 669}