public static function castString($value): string
    {
        if ($value !== null && !is_scalar($value)) {
            throw new InvalidArgumentException('Value could not be parsed to string');
        }

        return (string)$value;
    }