Make WordPress Core

Changeset 60659


Ignore:
Timestamp:
08/25/2025 01:08:28 PM (6 months ago)
Author:
SergeyBiryukov
Message:

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:

  • booleanbool
  • doublefloat
  • integerint
  • binarystring

References:

Follow-up to [1346], [11875].

Props TobiasBg, swissspidy, SergeyBiryukov.
See #63061.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/IXR/class-IXR-message.php

    r59056 r60659  
    178178                break;
    179179            case 'double':
    180                 $value = (double)trim($this->_currentTagContents);
     180                $value = (float)trim($this->_currentTagContents);
    181181                $valueFlag = true;
    182182                break;
     
    197197                break;
    198198            case 'boolean':
    199                 $value = (boolean)trim($this->_currentTagContents);
     199                $value = (bool)trim($this->_currentTagContents);
    200200                $valueFlag = true;
    201201                break;
  • trunk/src/wp-includes/class-json.php

    r55210 r60659  
    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
Note: See TracChangeset for help on using the changeset viewer.