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

WordPress Trac noreply at wordpress.org
Mon Sep 16 13:33:09 UTC 2024


#51525: Add new functions apply_filters_single_type() and
apply_filters_ref_array_single_type()
-------------------------------------------------+-------------------------
 Reporter:  jrf                                  |       Owner:  (none)
     Type:  feature request                      |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  2nd-opinion php8.x early has-patch   |     Focuses:
  has-unit-tests                                 |
-------------------------------------------------+-------------------------

Comment (by tabrisrp):

 Before going further with the changes in core itself, we have made an
 update on the library we created to mimick this concept of typed filters.
 The new version adds support for:
 - union types (i.e. int|string)
 - nullable types (i.e. (?string)
 - typed array (i.e. string[])

 The code is fully covered by unit/integration tests. [https://github.com
 /wp-media/apply-filters-typed/]

 Hopefully that would cover the concerns raised in the previous slack
 discussion, and help the solution go further for an adoption in core.

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


More information about the wp-trac mailing list