StringType
class StringType extends Type (View source)
Properties
| protected | $required | Whether the type is required. |
from Type |
| protected | $title | The type's title. |
from Type |
| protected | $description | The type's description. |
from Type |
| protected | $default | The default value for the type. |
from Type |
| protected array<int,mixed>|null | $enum | The set of allowed values for the type. |
from Type |
| protected | $nullable | Indicates if the type is nullable. |
from Type |
| protected | $minLength | The minimum length (inclusive). |
|
| protected | $maxLength | The maximum length (inclusive). |
|
| protected | $pattern | A regular expression the value must match. |
Methods
Dynamically pass static methods to the schema instance.
Set the minimum length (inclusive).
Set the maximum length (inclusive).
Set the pattern the value must satisfy.
Set the type's default value.
Details
static Type
__callStatic(string $name, mixed $arguments)
Dynamically pass static methods to the schema instance.
in
Type at line 45
Type
required(bool $required = true)
Indicate that the type is required.
in
Type at line 57
Type
nullable(bool $nullable = true)
Indicate that the type is optional.
in
Type at line 69
Type
title(string $value)
Set the type's title.
in
Type at line 79
Type
description(string $value)
Set the type's description.
in
Type at line 91
Type
enum(array $values)
Restrict the value to one of the provided enumerated values.
in
Type at line 104
array
toArray()
Convert the type to an array.
in
Type at line 112
string
toString()
Convert the type to its string representation.
in
Type at line 120
string
__toString()
Convert the type to its string representation.
StringType
min(int $value)
Set the minimum length (inclusive).
StringType
max(int $value)
Set the maximum length (inclusive).
StringType
pattern(string $value)
Set the pattern the value must satisfy.
StringType
default(string $value)
Set the type's default value.