class StringType extends Type

Properties

protected bool|null $required

Whether the type is required.

from  Type
protected string|null $title

The type's title.

from  Type
protected string|null $description

The type's description.

from  Type
protected mixed $default

The default value for the type.

from  Type
protected null|array<int, mixed> $enum

The set of allowed values for the type.

from  Type
protected bool|null $nullable

Indicates if the type is nullable.

from  Type
protected int|null $minLength

The minimum length (inclusive).

protected int|null $maxLength

The maximum length (inclusive).

protected string|null $pattern

A regular expression the value must match.

protected string|null $format

The format of the string.

Methods

static Type
__callStatic(string $name, array $arguments)

Dynamically pass static methods to the schema instance.

static ObjectType
object(Closure|array<string $, Type> $properties = '[]')

No description

static IntegerType
integer()

No description

static NumberType
number()

No description

static StringType
string()

No description

static BooleanType
boolean()

No description

static ArrayType
array()

No description

required(bool $required = true)

Indicate that the type is required.

from  Type
nullable(bool $nullable = true)

Indicate that the type is optional.

from  Type
title(string $value)

Set the type's title.

from  Type
description(string $value)

Set the type's description.

from  Type
enum(array|string $values)

Restrict the value to one of the provided enumerated values.

from  Type
array
toArray()

Convert the type to an array.

from  Type
string
toString()

Convert the type to its string representation.

from  Type
string
__toString()

Convert the type to its string representation.

from  Type
min(int $value)

Set the minimum length (inclusive).

max(int $value)

Set the maximum length (inclusive).

pattern(string $value)

Set the pattern the value must satisfy.

format(string $value)

Set the format of the string.

default(string $value)

Set the type's default value.

Details

in JsonSchema at line 23
static Type __callStatic(string $name, array $arguments)

Dynamically pass static methods to the schema instance.

Parameters

string $name
array $arguments

Return Value

Type

in JsonSchema at line 18
static ObjectType object(Closure|array<string $, Type> $properties = '[]')

No description

Parameters

Closure|array<string $
Type> $properties

Return Value

ObjectType

in JsonSchema at line 18
static IntegerType integer()

No description

Return Value

IntegerType

in JsonSchema at line 18
static NumberType number()

No description

Return Value

NumberType

in JsonSchema at line 18
static StringType string()

No description

Return Value

StringType

in JsonSchema at line 18
static BooleanType boolean()

No description

Return Value

BooleanType

in JsonSchema at line 18
static ArrayType array()

No description

Return Value

ArrayType

in Type at line 49
Type required(bool $required = true)

Indicate that the type is required.

Parameters

bool $required

Return Value

Type

in Type at line 61
Type nullable(bool $nullable = true)

Indicate that the type is optional.

Parameters

bool $nullable

Return Value

Type

in Type at line 73
Type title(string $value)

Set the type's title.

Parameters

string $value

Return Value

Type

in Type at line 83
Type description(string $value)

Set the type's description.

Parameters

string $value

Return Value

Type

in Type at line 97
Type enum(array|string $values)

Restrict the value to one of the provided enumerated values.

Parameters

array|string $values

Return Value

Type

Exceptions

InvalidArgumentException

in Type at line 118
array toArray()

Convert the type to an array.

Return Value

array

in Type at line 126
string toString()

Convert the type to its string representation.

Return Value

string

in Type at line 134
string __toString()

Convert the type to its string representation.

Return Value

string

at line 32
StringType min(int $value)

Set the minimum length (inclusive).

Parameters

int $value

Return Value

StringType

at line 42
StringType max(int $value)

Set the maximum length (inclusive).

Parameters

int $value

Return Value

StringType

at line 52
StringType pattern(string $value)

Set the pattern the value must satisfy.

Parameters

string $value

Return Value

StringType

at line 64
StringType format(string $value)

Parameters

string $value

Return Value

StringType

at line 74
StringType default(string $value)

Set the type's default value.

Parameters

string $value

Return Value

StringType