[wp-trac] [WordPress Trac] #45800: Add short circuits for WP_Comment_Query
WordPress Trac
noreply at wordpress.org
Tue Aug 6 18:55:12 UTC 2019
#45800: Add short circuits for WP_Comment_Query
-------------------------------------------------+-------------------------
Reporter: spacedmonkey | Owner:
| adamsilverstein
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.3
Component: Comments | Version: 3.1
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests dev- | Focuses:
feedback needs-dev-note |
-------------------------------------------------+-------------------------
Comment (by adamsilverstein):
> The only consideration I have is that the value returned in $comment_ids
can also be an int (if count is set), so perhaps the params doc clause
should be @param array|int|null or @param mixed, I don't know which one is
better.
Good point. Since we know the exact types that can be potentially
returned, we should list them out rather than using the ambiguous 'mixed'.
> Also, while we're on it, do we need to assign $this->comments =
$comment_ids;? Why don't we just return $comment_ids? If count is set, for
example, having an int on $this->comments won't make much sense, IMHO.
That is true. I think the main reason we do this is to ensure any
subsequent (in the sdme load) uses of the query object will reuse the
retrieved comments. It might be better to leave this up to filter
consumers though since we pass a reference to the query object. That way
they could set ids, comment objects or nothing at all (for the count
query). If we take this approach we should also re-examine the other
recently added short-circuit filters to ensure we build these
consistently.
> ps.: English isn't my first language, so I'm sorry if I'm saying
something obviously wrong here, but shouldn't it be bypass WordPress'
default instead of bypass WordPress's default? :)
Thanks for asking - this looks right to me. We are referring here to the
filters that belong to WordPress and in particular the singular WordPress
software. Adding a possessive `s` after a singular noun uses `'s` (ref:
https://www.thepunctuationguide.com/apostrophe.html).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45800#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list