Make WordPress Core


Ignore:
Timestamp:
10/08/2020 09:13:57 PM (6 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-admin/includes/class-wp-importer.php

    r47855 r49108  
    3838                                foreach ( $results as $r ) {
    3939                                        // Set permalinks into array.
    40                                         $hashtable[ $r->meta_value ] = intval( $r->post_id );
     40                                        $hashtable[ $r->meta_value ] = (int) $r->post_id;
    4141                                }
    4242                        }
     
    7070
    7171                if ( ! empty( $result ) ) {
    72                         $count = intval( $result[0]->cnt );
     72                        $count = (int) $result[0]->cnt;
    7373                }
    7474
     
    107107                                        // Explode comment_agent key.
    108108                                        list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent );
    109                                         $source_comment_id                   = intval( $source_comment_id );
     109                                        $source_comment_id                   = (int) $source_comment_id;
    110110
    111111                                        // Check if this comment came from this blog.
    112112                                        if ( $bid == $ca_bid ) {
    113                                                 $hashtable[ $source_comment_id ] = intval( $r->comment_ID );
     113                                                $hashtable[ $source_comment_id ] = (int) $r->comment_ID;
    114114                                        }
    115115                                }
Note: See TracChangeset for help on using the changeset viewer.