Make WordPress Core

Changeset 56352

Timestamp:
08/03/2023 12:08:30 PM (12 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use instanceof keyword instead of the is_a() function.

This is a micro-optimization that removes a few unnecessary function calls.

Follow-up to [31188], [34369], [38986], [41159], [43211], [43230], [44606], [45757].

Props ayeshrajans, jrf, rajinsharwar, costdev, mukesh27, SergeyBiryukov.
Fixes #58943.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/inc/template-tags.php

    r56121 r56352  
    141141 */
    142142function twentyseventeen_front_page_section( $partial = null, $id = 0 ) {
    143     if ( is_a( $partial, 'WP_Customize_Partial' ) ) {
     143    if ( ) {
    144144        // Find out the ID and set it up during a selective refresh.
    145145        global $twentyseventeencounter;
  • trunk/src/wp-includes/admin-bar.php

    r56220 r56352  
    898898                );
    899899            }
    900         } elseif ( is_a( $current_object, 'WP_User' ) && current_user_can( 'edit_user', $current_object->ID ) ) {
     900        } elseif ( && current_user_can( 'edit_user', $current_object->ID ) ) {
    901901            $edit_user_link = get_edit_user_link( $current_object->ID );
    902902            if ( $edit_user_link ) {
  • trunk/src/wp-includes/http.php

    r55990 r56352  
    355355    $cookie = wp_remote_retrieve_cookie( $response, $name );
    356356
    357     if ( ! is_a( $cookie, 'WP_Http_Cookie' ) ) {
     357    if ( ! ) ) {
    358358        return '';
    359359    }
  • trunk/src/wp-includes/user.php

    r56194 r56352  
    40334033    $request = wp_get_user_request( $request_id );
    40344034
    4035     if ( ! is_a( $request, 'WP_User_Request' ) || 'request-confirmed' !== $request->status ) {
     4035    if ( ! ) || 'request-confirmed' !== $request->status ) {
    40364036        return;
    40374037    }
     
    42454245    $request = wp_get_user_request( $request_id );
    42464246
    4247     if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) {
     4247    if ( ! ) || 'request-completed' !== $request->status ) {
    42484248        return;
    42494249    }
  • trunk/src/wp-login.php

    r56245 r56352  
    13041304
    13051305            // Check if it is time to add a redirect to the admin email confirmation screen.
    1306             if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( 'manage_options' ) ) {
     1306            if ( && $user->exists() && $user->has_cap( 'manage_options' ) ) {
    13071307                $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' );
    13081308
  • trunk/tests/phpunit/includes/testcase-rest-api.php

    r50283 r56352  
    44    protected function assertErrorResponse( $code, $response, $status = null ) {
    55
    6         if ( is_a( $response, 'WP_REST_Response' ) ) {
     6        if ( ) {
    77            $response = $response->as_error();
    88        }
  • trunk/tests/phpunit/tests/actions.php

    r53942 r56352  
    536536            foreach ( $filter as $identifier => $function ) {
    537537                if ( is_array( $function )
    538                     && is_a( $function['function'][0], 'MockAction' )
     538                    &&
    539539                    && 'action' === $function['function'][1]
    540540                ) {
Note: See TracChangeset for help on using the changeset viewer.