Improve memory efficiency
This avoids concatenating `$message` and `PHP_EOL` (if necessary) as a new value, greatly improving memory efficiency for large `$message`s.
This commit is contained in:
parent
00763f6e41
commit
c1df9f210e
@ -70,7 +70,7 @@ class StreamOutput extends Output
|
||||
*/
|
||||
protected function doWrite($message, $newline)
|
||||
{
|
||||
if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) {
|
||||
if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
|
||||
// should never happen
|
||||
throw new \RuntimeException('Unable to write output.');
|
||||
}
|
||||
|
Reference in New Issue
Block a user