Skip to content

Commit 1ab39ce

Browse files
Code Modernization: Replace non-canonical scalar type casts with canonical versions.
PHP 8.5 deprecates four alternative scalar type names in favor of their canonical names: * `boolean` → `bool` * `double` → `float` * `integer` → `int` * `binary` → `string` References: * [https://php.watch/versions/8.5/boolean-double-integer-binary-casts-deprecated PHP.Watch: PHP 8.5: Non-canonical scalar type casts (boolean|double|integer|binary) deprecated] * [https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_non-standard_cast_names PHP RFC: Deprecations for PHP 8.5: Deprecate non-standard cast names] Follow-up to [1346], [11875]. Props TobiasBg, swissspidy, SergeyBiryukov. See #63061. git-svn-id: https://develop.svn.wordpress.org/trunk@60659 602fd350-edb4-49c9-b593-d223f7449a82
1 parent a291462 commit 1ab39ce

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/wp-includes/IXR/class-IXR-message.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function tag_close($parser, $tag)
177177
$valueFlag = true;
178178
break;
179179
case 'double':
180-
$value = (double)trim($this->_currentTagContents);
180+
$value = (float)trim($this->_currentTagContents);
181181
$valueFlag = true;
182182
break;
183183
case 'string':
@@ -196,7 +196,7 @@ function tag_close($parser, $tag)
196196
}
197197
break;
198198
case 'boolean':
199-
$value = (boolean)trim($this->_currentTagContents);
199+
$value = (bool)trim($this->_currentTagContents);
200200
$valueFlag = true;
201201
break;
202202
case 'base64':

src/wp-includes/class-json.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,8 @@ function decode($str)
662662
// return (float)$str;
663663

664664
// Return float or int, as appropriate
665-
return ((float)$str == (integer)$str)
666-
? (integer)$str
665+
return ((float)$str == (int)$str)
666+
? (int)$str
667667
: (float)$str;
668668

669669
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {

0 commit comments

Comments
 (0)