[wp-trac] [WordPress Trac] #57686: Introduce wp_trigger_error() to compliment _doing_it_wrong()
WordPress Trac
noreply at wordpress.org
Wed Sep 6 15:01:01 UTC 2023
#57686: Introduce wp_trigger_error() to compliment _doing_it_wrong()
-------------------------------------------------+-------------------------
Reporter: azaozz | Owner:
| hellofromTonya
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.4
Component: General | Version:
Severity: normal | Resolution:
Keywords: needs-dev-note has-patch has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Comment (by costdev):
> I think keeping it as the first required parameter aligns well to other
`trigger_error()` handling functions in Core such as
`_deprecated_function()`, `_deprecated_argument()`, etc.
Oh snap! You ''know'' I'm a stickler for consistency! ➕
> I suspect the majority of the error triggering use cases will occur
within a function/method scope, rather than in global scope.
I agree!
> For those in global scope or when the developer does not want the
function to appear in that position within the message, an empty string
can be passed.
I think that's what started my thinking on this. "What's the main
parameter of this function and what supplement's it?" - The "main" one for
me was `$message`, with `$function_name` and `$error_level` supplementing
it, so passing an empty string for the first parameter felt weird.
Since the `$function_name` will be included in nearly all cases, and for
consistency's sake, I'm happy to go with `$function_name, $message,
$error_level = E_USER_NOTICE`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57686#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list