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.
Built from https://develop.svn.wordpress.org/trunk@49108


git-svn-id: http://core.svn.wordpress.org/trunk@48870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2020-10-08 21:15:13 +00:00
parent f25804699f
commit 897f004a9c
79 changed files with 273 additions and 274 deletions

View File

@@ -249,8 +249,8 @@ final class WP_Customize_Nav_Menus {
'type' => 'post_type',
'type_label' => $post_type_label,
'object' => $post->post_type,
'object_id' => intval( $post->ID ),
'url' => get_permalink( intval( $post->ID ) ),
'object_id' => (int) $post->ID,
'url' => get_permalink( (int) $post->ID ),
);
}
} elseif ( 'taxonomy' === $type ) {
@@ -281,8 +281,8 @@ final class WP_Customize_Nav_Menus {
'type' => 'taxonomy',
'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
'object' => $term->taxonomy,
'object_id' => intval( $term->term_id ),
'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ),
'object_id' => (int) $term->term_id,
'url' => get_term_link( (int) $term->term_id, $term->taxonomy ),
);
}
}
@@ -410,8 +410,8 @@ final class WP_Customize_Nav_Menus {
'type' => 'post_type',
'type_label' => $post_type_label,
'object' => $post->post_type,
'object_id' => intval( $post->ID ),
'url' => get_permalink( intval( $post->ID ) ),
'object_id' => (int) $post->ID,
'url' => get_permalink( (int) $post->ID ),
);
}
@@ -436,8 +436,8 @@ final class WP_Customize_Nav_Menus {
'type' => 'taxonomy',
'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
'object' => $term->taxonomy,
'object_id' => intval( $term->term_id ),
'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ),
'object_id' => (int) $term->term_id,
'url' => get_term_link( (int) $term->term_id, $term->taxonomy ),
);
}
}