Skip to content

wp_trigger_error has a wrong @phpstan-param #270

Closed
@jcvignoli

Description

@jcvignoli

wp_trigger_error() functions reads as follows:

    /**
     * Generates a user-level error/warning/notice/deprecation message.
     *
     * Generates the message when `WP_DEBUG` is true.
     *
     * @since 6.4.0
     *
     * @param string $function_name The function that triggered the error.
     * @param string $message       The message explaining the error.
     *                              The message can contain allowed HTML 'a' (with href), 'code',
     *                              'br', 'em', and 'strong' tags and http or https protocols.
     *                              If it contains other HTML tags or protocols, the message should be escaped
     *                              before passing to this function to avoid being stripped {@see wp_kses()}.
     * @param int    $error_level   Optional. The designated error type for this error.
     *                              Only works with E_USER family of constants. Default E_USER_NOTICE.
     * @phpstan-param callable-string $function_name
     * @phpstan-param \E_USER_ERROR|\E_USER_WARNING|\E_USER_NOTICE|\E_USER_DEPRECATED $error_level
     * @phpstan-return void
     */
    function wp_trigger_error($function_name, $message, $error_level = \E_USER_NOTICE)
    {
    }

However, according to WP documentation (or even the code), I don't see the reason for @phpstan-param callable-string $function_name. It is a string that is used as such in the function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions