[wp-trac] [WordPress Trac] #51525: Add new functions apply_filters_typesafe() and apply_filters_ref_array_typesafe()

WordPress Trac noreply at wordpress.org
Mon Oct 19 16:07:49 UTC 2020


#51525: Add new functions apply_filters_typesafe() and
apply_filters_ref_array_typesafe()
------------------------------------------+---------------------
 Reporter:  jrf                           |       Owner:  (none)
     Type:  feature request               |      Status:  new
 Priority:  normal                        |   Milestone:  5.6
Component:  General                       |     Version:  trunk
 Severity:  normal                        |  Resolution:
 Keywords:  2nd-opinion needs-patch php8  |     Focuses:
------------------------------------------+---------------------

Comment (by TimothyBlynJacobs):

 @jrf I agree Core shouldn't try and actually implement LSP out of the box.

 I think instead of a complex args array, we should simplify this to
 allowing users to pass a `callable( $original, $filtered ) : bool`. We
 could maybe create a predefined version that uses the simplest of type
 mechanics. And create custom ones for things like accepting a `callable`.

 IMO a developer creating a wrong object or callable is not significantly
 less unlikely than providing the incorrect arg type.

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


More information about the wp-trac mailing list