length = $length; } /** * @inheritDoc */ public function validate(ValidationContext $context, Schema $schema): ?ValidationError { if ($this->length === 0) { return null; } $length = $context->getStringLength(); if ($length >= $this->length) { return null; } return $this->error($schema, $context, 'minLength', "Minimum string length is {min}, found {length}", [ 'min' => $this->length, 'length' => $length, ]); } }