amphp / byte-stream

A non-blocking stream abstraction for PHP based on Amp.
https://amphp.org/byte-stream
MIT License
363 stars 31 forks source link

Error in Amp\ByteStream\splitLines() #109

Closed PhantomArt closed 6 months ago

PhantomArt commented 6 months ago

$cancellation is not passed to split(). Apparently, this is not how it should be.

/**
 * Splits the stream into lines.
 *
 * @return \Traversable<int, string>
 */
function splitLines(ReadableStream $source, ?Cancellation $cancellation = null): \Traversable
{
    foreach (split($source, "\n") as $line) {
        yield \rtrim($line, "\r");
    }
}