Make WordPress Core


Ignore:
Timestamp:
05/15/2023 10:26:54 AM (19 months ago)
Author:
SergeyBiryukov
Message:

General: Remove a few is_object() checks followed by instanceof operator.

This is a minor performance enhancement:

  • If an object is passed, the call to is_object() will be redundant.
  • If a non-object is passed, the instanceof operator (a variant of is_a()) will first check if it is an object before doing any further processing.

Therefore, no additional processing cycles should be wasted in both cases.

Follow-up to [6779], [48798], [48905], [49194], [55748].

Props Presskopp, costdev.
Fixes #58309.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-pclzip.php

    r51686 r55757  
    11711171    $this->privErrorReset();
    11721172
    1173     // ----- Look if the $p_archive is a PclZip object
    1174     if (is_object($p_archive) && $p_archive instanceof pclzip)
     1173    // ----- Look if the $p_archive is an instantiated PclZip object
     1174    if ($p_archive instanceof pclzip)
    11751175    {
    11761176
     
    12351235    }
    12361236
    1237     // ----- Look if the $p_archive_to_add is a PclZip object
    1238     if (is_object($p_archive_to_add) && $p_archive_to_add instanceof pclzip)
     1237    // ----- Look if the $p_archive_to_add is an instantiated PclZip object
     1238    if ($p_archive_to_add instanceof pclzip)
    12391239    {
    12401240
Note: See TracChangeset for help on using the changeset viewer.