stream === null) { $this->stream = fopen('php://temp', 'w+'); } return new ConsoleSectionOutput( $this->stream, $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter() ); } public function fetch(): string { // Получаем основной буфер $content = parent::fetch(); // Если есть stream от секций, читаем его тоже if ($this->stream !== null) { rewind($this->stream); $streamContent = stream_get_contents($this->stream); if ($streamContent !== false) { $content .= $streamContent; } // Очищаем stream для следующего вызова ftruncate($this->stream, 0); rewind($this->stream); } return $content; } }