src/Type/Definition/IntType.php
private function coerceInt($value)
    {
        if ($value === '') {
            throw new Error(
                'Int cannot represent non 32-bit signed integer value: (empty string)'
            );
        }

        $num = floatval($value);
        if ((! is_numeric($value) && ! is_bool($value)) || $num > self::MAX_INT || $num < self::MIN_INT) {
            throw new Error(
                'Int cannot represent non 32-bit signed integer value: ' .
                Utils::printSafe($value)
            );
        }
        $int = intval($num);
        // int cast with == used for performance reasons
        // phpcs:ignore
        if ($int != $num) {
            throw new Error(
                'Int cannot represent non-integer value: ' .
                Utils::printSafe($value)
            );
        }

        return $int;
    }
private function coerceInt($value)
    {
        if ($value === '') {
            throw new Error(
                'Int cannot represent non 32-bit signed integer value: (empty string)'
            );
        }

        $num = floatval($value);
        if ((! is_numeric($value) && ! is_bool($value)) || $num > self::MAX_INT || $num < self::MIN_INT) {
            throw new Error(
                'Int cannot represent non 32-bit signed integer value: ' .
                Utils::printSafe($value)
            );
        }
        $int = intval($num);
        // int cast with == used for performance reasons
        // phpcs:ignore
        if ($int != $num) {
            throw new Error(
                'Int cannot represent non-integer value: ' .
                Utils::printSafe($value)
            );
        }

        return $int;
    }
private function coerceInt ( $ value ) { if ( $ value === '' ) { throw new Error ( 'Int cannot represent non 32-bit signed integer value: (empty string)' ) ; } $ num = floatval ( $ value ) ; if ( ( ! is_numeric ( $ value ) && ! is_bool ( $ value ) ) || $ num > self :: MAX_INT || $ num < self :: MIN_INT ) { throw new Error ( 'Int cannot represent non 32-bit signed integer value: ' . Utils :: printSafe ( $ value ) ) ; } $ int = intval ( $ num ) ; // int cast with == used for performance reasons // phpcs:ignore if ( $ int != $ num ) { throw new Error ( 'Int cannot represent non-integer value: ' . Utils :: printSafe ( $ value ) ) ; } return $ int ; }
@param mixed $value

@return int
@param mixed $value