Automattic\WooCommerce\Vendor\GraphQL\Type\Definition

IDType::serializepublicWC 1.0

Метод класса: IDType{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$IDType = new IDType();
$IDType->serialize( $value ): string;
$value(обязательный)
.

Код IDType::serialize() WC 10.9.1

public function serialize($value): string
{
    $canCast = is_string($value)
        || is_int($value)
        || (is_object($value) && method_exists($value, '__toString'));

    if (! $canCast) {
        $notID = Utils::printSafe($value);
        throw new SerializationError("ID cannot represent a non-string and non-integer value: {$notID}");
    }

    return (string) $value;
}