Automattic\WooCommerce\Vendor\GraphQL\Type\Definition

BooleanType::serializepublicWC 1.0

Serialize the given value to a Boolean.

The Automattic\WooCommerce\Vendor\GraphQL spec leaves this up to the implementations, so we just do what PHP does natively to make this intuitive for developers.

Method of the class: BooleanType{}

No Hooks.

Returns

null. Nothing (null).

Usage

$BooleanType = new BooleanType();
$BooleanType->serialize( $value ): bool;
$value(required)
.

BooleanType::serialize() code WC 10.9.1

public function serialize($value): bool
{
    return (bool) $value;
}