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

WordPress Trac noreply at wordpress.org
Wed Sep 6 14:56:46 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 hellofromTonya):

 Replying to [comment:17 costdev]:
 > What do you think about moving `$function_name` to be a third, optional
 parameter so it's not necessary to include an empty string as the first
 parameter if it's not needed? This would be closer to PHP's native
 `trigger_error()` also.

 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.

 I suspect the majority of the error triggering use cases will occur within
 a function/method scope, rather than in global scope.

 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.

 What do you think @costdev?

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


More information about the wp-trac mailing list