[wp-trac] [WordPress Trac] #57067: Replace certain `array_key_exists()` calls with `isset()` once PHP requirement is raised to 7.0+

WordPress Trac noreply at wordpress.org
Tue Aug 1 20:30:02 UTC 2023


#57067: Replace certain `array_key_exists()` calls with `isset()` once PHP
requirement is raised to 7.0+
------------------------------+--------------------------
 Reporter:  flixos90          |       Owner:  flixos90
     Type:  enhancement       |      Status:  closed
 Priority:  normal            |   Milestone:  6.4
Component:  Themes            |     Version:
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:  performance
------------------------------+--------------------------
Changes (by flixos90):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56345" 56345]:
 {{{
 #!CommitTicketReference repository="" revision="56345"
 Themes: Use `isset` instead of `array_key_exists` in `WP_Theme_JSON`
 class.

 With the minimum PHP version requirement raised to 7.0, we can now use
 `isset` on constants that are arrays. Since `isset` is slightly faster
 than `array_key_exists` (and the different handling of `null` values is
 irrelevant for the updates here), remaining instances of
 `array_key_exists` in the `WP_Theme_JSON` class are replaced in this
 changeset.

 Props soean.
 Fixes #57067.
 }}}

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


More information about the wp-trac mailing list