Automattic\WooCommerce\Vendor\GraphQL\Type\Definition

IntType::parseValuepublicWC 1.0

Method of the class: IntType{}

No Hooks.

Returns

null. Nothing (null).

Usage

$IntType = new IntType();
$IntType->parseValue( $value ): int;
$value(required)
.

IntType::parseValue() code WC 10.9.1

public function parseValue($value): int
{
    $isInt = is_int($value)
        || (is_float($value) && floor($value) === $value);

    if (! $isInt) {
        $notInt = Utils::printSafeJson($value);
        throw new Error("Int cannot represent non-integer value: {$notInt}");
    }

    if ($value > self::MAX_INT || $value < self::MIN_INT) {
        $outOfRangeInt = Utils::printSafeJson($value);
        throw new Error("Int cannot represent non 32-bit signed integer value: {$outOfRangeInt}");
    }

    return (int) $value;
}