Make WordPress Core


Ignore:
Timestamp:
10/08/2020 09:13:57 PM (4 years ago)
Author:
SergeyBiryukov
Message:

General: Replace older-style PHP type conversion functions with type casts.

This improves performance, readability, and consistency throughout core.

  • intval()(int)
  • strval()(string)
  • floatval()(float)

Props ayeshrajans.
Fixes #42918.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r49043 r49108  
    10491049    }
    10501050
    1051     $term_id = intval( $term_id );
     1051    $term_id = (int) $term_id;
    10521052
    10531053    $terms = _get_term_hierarchy( $taxonomy );
     
    34913491    foreach ( $_term_ids as $term_id ) {
    34923492        if ( is_numeric( $term_id ) ) {
    3493             $term_ids[] = intval( $term_id );
     3493            $term_ids[] = (int) $term_id;
    34943494        } elseif ( isset( $term_id->term_id ) ) {
    3495             $term_ids[] = intval( $term_id->term_id );
     3495            $term_ids[] = (int) $term_id->term_id;
    34963496        }
    34973497    }
     
    39493949    if ( is_object( $term_id ) ) {
    39503950        $shared_term = $term_id;
    3951         $term_id     = intval( $shared_term->term_id );
     3951        $term_id     = (int) $shared_term->term_id;
    39523952    }
    39533953
    39543954    if ( is_object( $term_taxonomy_id ) ) {
    39553955        $term_taxonomy    = $term_taxonomy_id;
    3956         $term_taxonomy_id = intval( $term_taxonomy->term_taxonomy_id );
     3956        $term_taxonomy_id = (int) $term_taxonomy->term_taxonomy_id;
    39573957    }
    39583958
     
    41214121    $_shared_terms = array();
    41224122    foreach ( $shared_terms as $shared_term ) {
    4123         $term_id                   = intval( $shared_term->term_id );
     4123        $term_id                   = (int) $shared_term->term_id;
    41244124        $_shared_terms[ $term_id ] = $shared_term;
    41254125    }
     
    41354135    $taxonomies         = array();
    41364136    foreach ( $shared_tts as $shared_tt ) {
    4137         $term_id = intval( $shared_tt->term_id );
     4137        $term_id = (int) $shared_tt->term_id;
    41384138
    41394139        // Don't split the first tt belonging to a given term_id.
Note: See TracChangeset for help on using the changeset viewer.