src/Text/TextWriter.php
public function write(string $text): \Generator
    {
        $length = strlen($text);

        $this->buffer->push($text);

        if ($this->autoFlush || $this->buffer->getLength() > $this->bufferSize) {
            yield from $this->flush();
        }

        return $length;
    }
public function write(string $text): \Generator
    {
        $length = strlen($text);

        $this->buffer->push($text);

        if ($this->autoFlush || $this->buffer->getLength() > $this->bufferSize) {
            yield from $this->flush();
        }

        return $length;
    }
@coroutine

Writes a value to the stream.

The given value will be coerced to a string before being written. The resulting
string will be written to the internal buffer; if the buffer is full, the entire
buffer will be flushed to the stream.

@param mixed $text A printable value that can be coerced to a string.

@return \Generator

@resolve int Number of bytes written to the buffer.

@throws \Icicle\Awaitable\Exception\TimeoutException If the operation times out.
@throws \Icicle\Stream\Exception\UnwritableException If the stream is no longer writable.
@throws \Icicle\Stream\Exception\ClosedException If the stream is unexpectedly closed.