[wp-trac] [WordPress Trac] #43345: term_exists() may return 0 which is not a text-documented return type
WordPress Trac
noreply at wordpress.org
Sun Feb 18 07:58:12 UTC 2018
#43345: term_exists() may return 0 which is not a text-documented return type
-------------------------+-----------------------------
Reporter: dotancohen | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.9.4
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
The PHPDoc for term_exists() reads as follows:
> Returns null if the term does not exist. Returns the term ID if no
taxonomy is specified and the term ID exists. Returns an array of the term
ID and the term taxonomy ID the taxonomy is specified and the pairing
exists.
Despite this, under some conditions (`$term===0`) the method return `int
0`. The attached patch rectifies this to return `null`, and additionally
updates the `@return` tag datatype from mixed to `string|array|null` for
better IDE support.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43345>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list