public static function valueDoesNotMatchType(FieldDefinition $type, $value) : InvalidValueException { return new self(sprintf("Value \"%s\" does not match type \"%s\"", (string) new StringConverter($value), $type->name())); }
/** * @param $value * * @return string * @throws InvalidValueException */ public function serialize($value) : string { if (!is_numeric($value)) { throw InvalidValueException::valueDoesNotMatchType($this, $value); } return (string) (double) $value; }