[null, 'Translation key or message for invalid value', 'string'], ]; /** * The given value is valid if it is of type float or a string matching the regular expression [0-9.e+-] * * @param mixed $value The value that should be validated */ public function isValid(mixed $value): void { if (is_float($value)) { return; } if (!is_string($value) || !str_contains($value, '.') || preg_match('/^[0-9.e+-]+$/', $value) !== 1) { $this->addError($this->translateErrorMessage($this->message), 1221560288); } } }