Make WordPress Core


Ignore:
Timestamp:
10/08/2020 09:13:57 PM (3 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/class-wp-customize-nav-menus.php

    r48620 r49108  
    250250                    'type_label' => $post_type_label,
    251251                    'object'     => $post->post_type,
    252                     'object_id'  => intval( $post->ID ),
    253                     'url'        => get_permalink( intval( $post->ID ) ),
     252                    'object_id'  => (int) $post->ID,
     253                    'url'        => get_permalink( (int) $post->ID ),
    254254                );
    255255            }
     
    282282                    'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
    283283                    'object'     => $term->taxonomy,
    284                     'object_id'  => intval( $term->term_id ),
    285                     'url'        => get_term_link( intval( $term->term_id ), $term->taxonomy ),
     284                    'object_id'  => (int) $term->term_id,
     285                    'url'        => get_term_link( (int) $term->term_id, $term->taxonomy ),
    286286                );
    287287            }
     
    411411                'type_label' => $post_type_label,
    412412                'object'     => $post->post_type,
    413                 'object_id'  => intval( $post->ID ),
    414                 'url'        => get_permalink( intval( $post->ID ) ),
     413                'object_id'  => (int) $post->ID,
     414                'url'        => get_permalink( (int) $post->ID ),
    415415            );
    416416        }
     
    437437                    'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
    438438                    'object'     => $term->taxonomy,
    439                     'object_id'  => intval( $term->term_id ),
    440                     'url'        => get_term_link( intval( $term->term_id ), $term->taxonomy ),
     439                    'object_id'  => (int) $term->term_id,
     440                    'url'        => get_term_link( (int) $term->term_id, $term->taxonomy ),
    441441                );
    442442            }
Note: See TracChangeset for help on using the changeset viewer.