WooCommerce Code Reference

ScalarType
in package

Overrides the GraphQL type for a property with a custom scalar.

By default the builder maps PHP types to built-in GraphQL scalars (String, Int, Float, Boolean). Use this attribute when a property should use a custom scalar type instead, such as DateTime.

Example: #[ScalarType(DateTime::class)] on a ?string $date_created property produces the GraphQL type DateTime instead of String.

Table of Contents

__construct()  : mixed
Constructor.

Methods

__construct()

Constructor.

public __construct(string $type) : mixed
Parameters
$type : string

The fully-qualified class name of the custom scalar (e.g. DateTime::class).

Return values
mixed