[wp-trac] [WordPress Trac] #57686: Introduce wp_trigger_error() to compliment _doing_it_wrong()

WordPress Trac noreply at wordpress.org
Wed Sep 6 19:17:11 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 commit                                   |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * keywords:  needs-dev-note has-patch has-unit-tests => needs-dev-note has-
     patch has-unit-tests commit


Comment:

 In talking with @azaozz, he's okay with [https://github.com/WordPress
 /wordpress-develop/pull/5144 lean version]. He's also suggesting to
 replace `trigger_error()` in each of the `_deprecated_*()` and
 `_doing_it_wrong()` functions.

 As follow patches and commits:

 * Each of the `trigger_error()` instances can be replaced with
 `wp_trigger_error()`.

 * Each `_doing_it_wrong()` should be evaluated to determine if it should
 or could use `wp_trigger_error()` instead. For example, instead of bailing
 out when not receiving a `string` data type, handle it automatically if
 it's scalar type and trigger `wp_trigger_error()`. IMO there is a valid
 use case for `_doing_it_wrong()` (see comment:21) when the code won't run
 and it's clearly a plugin or theme doing it wrong.

 * Once there's consensus on which function to use and when, then each
 function's docblock can be improved to include that information (which
 will then be available in the developers docs).

 Marking https://github.com/WordPress/wordpress-develop/pull/5144 for
 commit.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57686#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list