src/Stream.php
public function write($string)
    {
        if (($written = fwrite($this->fp, $string)) === false) {
            throw new \RuntimeException('Unable to write string to the stream');
        }

        return $written;
    }
public function write($string)
    {
        if (($written = fwrite($this->fp, $string)) === false) {
            throw new \RuntimeException('Unable to write string to the stream');
        }

        return $written;
    }
Write data to the stream.

@param string $string The string that is to be written.

@return int Returns the number of bytes written to the stream.
@throws \RuntimeException on failure.