[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
Thu Aug 8 17:38:14 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 mathieulamiotwpmedia):
It came up in the discussion as apparently, a majority of filters in the
core could not use a single type. I don't know the Core well enough to
have an opinion on that though.
I can see how nullable types could be used, abusing a bit boolean with
null cases for instance.
About union types, we would probably not use it as plugin or theme
developers, because as you mention, it's a bit missing the goal of
simplifying safe checks (and that's probably why we did not even think
about it in the first place). But if it is not too complex to add and it
can help adoption for already existing filters, we would give it a go...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51525#comment:34>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list