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

@@ -260,7 +260,7 @@ class WP_Network_Query {
// If querying for a count only, there's nothing more to do.
if ( $this->query_vars['count'] ) {
// $network_ids is actually a count in this case.
return intval( $network_ids );
return (int) $network_ids;
}
$network_ids = array_map( 'intval', $network_ids );
@@ -469,7 +469,7 @@ class WP_Network_Query {
$this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}";
if ( $this->query_vars['count'] ) {
return intval( $wpdb->get_var( $this->request ) );
return (int) $wpdb->get_var( $this->request );
}
$network_ids = $wpdb->get_col( $this->request );