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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49108 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-10-08 21:13:57 +00:00
parent eeae797340
commit 79703088c4
94 changed files with 306 additions and 307 deletions
+2 -2
View File
@@ -299,7 +299,7 @@ function xml_array_dumbdown( &$data ) {
function dmp( ...$args ) {
foreach ( $args as $thing ) {
echo ( is_scalar( $thing ) ? strval( $thing ) : var_export( $thing, true ) ), "\n";
echo ( is_scalar( $thing ) ? (string) $thing : var_export( $thing, true ) ), "\n";
}
}
@@ -319,7 +319,7 @@ function gen_tests_array( $name, $array ) {
$out = array();
foreach ( $array as $k => $v ) {
if ( is_numeric( $k ) ) {
$index = strval( $k );
$index = (string) $k;
} else {
$index = "'" . addcslashes( $k, "\n\r\t'\\" ) . "'";
}