Automattic\WooCommerce\Vendor\GraphQL\Executor

ReferenceExecutor::fixResultsIfEmptyArray │ protected static │ WC 1.0

Differentiate empty objects from empty lists.

Method of the class: ReferenceExecutor{}

No Hooks.

Returns

non-empty-array<mixed>|\stdClass|mixed.

Usage

$result = ReferenceExecutor::fixResultsIfEmptyArray( $results );
$results(array|mixed) (required)
.

Notes

See: https://github.com/webonyx/graphql-php/issues/59

ReferenceExecutor::fixResultsIfEmptyArray() code WC 11.1.2

protected static function fixResultsIfEmptyArray($results)
{
    if ($results === []) {
        return new \stdClass();
    }

    return $results;
}