[wp-trac] [WordPress Trac] #58309: Save a few processing cycles by removing redundant is_object

WordPress Trac noreply at wordpress.org
Sun May 14 15:12:20 UTC 2023


#58309: Save a few processing cycles by removing redundant is_object
-------------------------+-----------------------------
 Reporter:  Presskopp    |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
  Focuses:  performance  |
-------------------------+-----------------------------
 In addition to #58290 we could possibly remove more instances of
 {{{is_object}}}, namely in:

 wp-includes\rest-api\fields\class-wp-rest-meta-fields.php, ~L.477
 {{{if ( is_object( $value ) && ! ( $value instanceof JsonSerializable ) )
 {}}}

 wp-includes\class-json.php, ~L.929
 {{{} elseif (is_object($data) && ($data instanceof services_json_error
 ||}}}

 wp-includes\media.php, ~L.3762
 {{{|| is_object( $image ) && $image instanceof GdImage}}}

 However, one could argue that, for the sake of clear readability, it would
 be better to leave the {{{is_object}}} in, to indicate that an object is
 expected there. 58290 would need to be reverted then.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58309>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list