[wp-trac] [WordPress Trac] #56262: WP_List_Util::pluck doesn't support a null $field

WordPress Trac noreply at wordpress.org
Tue Jul 26 17:45:51 UTC 2022

#56262: WP_List_Util::pluck doesn't support a null $field
 Reporter:  iandunn                  |       Owner:  (none)
     Type:  enhancement              |      Status:  new
 Priority:  low                      |   Milestone:  Awaiting Review
Component:  General                  |     Version:  3.1
 Severity:  minor                    |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:

Comment (by iandunn):

 [attachment:"56262.diff"] looks like a good start!

 Two helpful improvements could be adding
 /writing-phpunit-tests/ unit tests] and [https://developer.wordpress.org
 /coding-standards/inline-documentation-standards/php/ inline docs] (adding
 a `@since`, updating the `$field` parameter description, etc).

 `is_null( $field )` might be more explicit / self documenting than
 `isset()`, especially after the `$field` docs are updated to mention that
 `null` can be passed.

 Using `isset()` could also unintentionally hide PHP warnings (and
 therefore bugs) when devs make a typo in the field name, etc.

Ticket URL: <https://core.trac.wordpress.org/ticket/56262#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list