public function write($string): int
    {
        if (!is_string($string)) {
            throw new InvalidArgumentException(sprintf(
                'Argument 1 passed to %s->write needs to be string, %s given',