Automattic\WooCommerce\Vendor\GraphQL\Type\Definition
StringType::serialize
Method of the class: StringType{}
No Hooks.
Returns
null. Nothing (null).
Usage
$StringType = new StringType(); $StringType->serialize( $value ): string;
- $value(required)
- .
StringType::serialize() StringType::serialize code WC 10.9.1
public function serialize($value): string
{
$canCast = is_scalar($value)
|| (is_object($value) && method_exists($value, '__toString'))
|| $value === null;
if (! $canCast) {
$notStringable = Utils::printSafe($value);
throw new SerializationError("String cannot represent value: {$notStringable}");
}
return (string) $value;
}