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/category-template.php

    r49060 r49108  
    434434            /** This filter is documented in wp-includes/category-template.php */
    435435            $show_option_all = apply_filters( 'list_cats', $parsed_args['show_option_all'], null );
    436             $selected        = ( '0' === strval( $parsed_args['selected'] ) ) ? " selected='selected'" : '';
     436            $selected        = ( '0' === (string) $parsed_args['selected'] ) ? " selected='selected'" : '';
    437437            $output         .= "\t<option value='0'$selected>$show_option_all</option>\n";
    438438        }
     
    738738            $link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
    739739        } else {
    740             $link = get_term_link( intval( $tag->term_id ), $tag->taxonomy );
     740            $link = get_term_link( (int) $tag->term_id, $tag->taxonomy );
    741741        }
    742742
Note: See TracChangeset for help on using the changeset viewer.