Index

StringValidator

MMO\core\schemas · 1 symbol · generated 30 Sep 2026

class

StringValidator

Validator.php:411

Validator for a string value: 'maxLength'/'minLength'/'pattern'/'format'.

class MMO\core\schemas\StringValidator extends MMO\core\schemas\Validator
Namespace
MMO\core\schemas
Extends
Validator

Constants1

KEYS

const KEYS = […11 items]

Methods5

validate_format()

Validator.php:435
protected function validate_format(): Generator
See
validateFormat for the recognized 'format' names (e.g. 'email', 'datetime', 'phone'): a name it has no case for passes, so JSON Schema's 'date-time' and 'uuid' are never checked.
returnsGenerator

validate_maxLength()

Validator.php:421

Length is measured in characters (length, multibyte-aware), not bytes.

protected function validate_maxLength(): Generator
returnsGenerator
Inherited members (20)
ConstantsDeclared byDescription
ERROR_TEMPLATESValidatorHuman-readable message template per keyword, used by toError.
PropertiesDeclared byDescription
keyValidatorThis validator's key/index within its $parent (e.g.
parentValidatorThe validator for the enclosing value, or null at the root.
schemaValidatorThe schema it's validated against.
valueValidatorThe value being validated.
MethodsDeclared byDescription
createInPlaceValidator($schema)ValidatorA validator of this same value against another schema: an allOf/anyOf/oneOf branch, not, if/then/else, a dependent schema.
describeAssert($assert)ValidatorWhat a failing keyword expected, as plain text: a list of types reads null|string.
getIterator()Validator\IteratorAggregate::getIterator -- yields schemaPath => Validator for every keyword this value fails (the Validator being the (sub-)validator whose value actually failed that keyword, not necessa…
getPath($join)Validator
Reorder($value)ValidatorRecursively sort $value's keys (and, in turn, every nested array's keys), in place -- used before comparing two structures for equality regardless of key order (validate_enum/validate_const).
setParent($validator, $key)ValidatorAttach this validator (for a nested value) under $validator, at $key (a property name or array index) -- used to build getPath.
toError($schemaPath)ValidatorBuild a human-readable error for a failing schema path (a key yielded by getIterator/a validate_* method), this validator being the one that failed.
validate_allOf()Validator'allOf': the value must validate against every listed schema; each schema's own failures are all yielded (not just the first).
validate_anyOf()Validator'anyOf': the value must validate against at least one listed schema; if none match, every schema's failures are yielded together.
validate_const()Validator'const': same as a single-value validate_enum.
validate_enum()Validator'enum': the value must strictly equal (order-independent for arrays/objects, and int/float-interchangeable for whole numbers) one of the declared constants.
validate_if()Validator'if'/'then'/'else': validates against 'then' if the value matches 'if', otherwise against 'else' (each defaulting to TrueSchema, i.e.
validate_not()Validator'not': the value must NOT validate against the given schema.
validate_oneOf()Validator'oneOf': the value must validate against exactly one listed schema -- matching zero (all schemas' failures yielded) or more than one (a single "matched more than one" error) both fail.
__construct($schema, $value)Validator