wp-includes/rest-api.php:1598Determines if a given value is integer-like.
$maybe_integermixedboolfunction rest_is_integer( $maybe_integer ): bool { if ( is_int( $maybe_integer ) ) { return true; } // A canonical integer string of any magnitude — verified without float conversion. if ( is_string( $maybe_integer ) && preg_match( '/^\s*[+-]?[0-9]+\s*$/', $maybe_integer ) ) { return true; } // Decimal and scientific-notation strings (and floats) keep their historical behavior. if ( ! is_numeric( $maybe_integer ) ) { return false; } $float_value = (float) $maybe_integer; /* * The strict equality here is not the unreliable "are two computed floats equal" comparison * (e.g. 0.1 + 0.2 === 0.3, which is false). It compares a float to its own floor() to ask * "does this float have a fractional part?". A float is whole exactly when it equals its floor, * so the comparison is exact and safe regardless of floating-point representation error. */ return floor( $float_value ) === $float_value;}Introduced in 5.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/rest-api.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.