From a6176a7beb8791d464131e3e7f7102afb7e649e2 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 13 Jan 2020 13:36:09 +0100 Subject: [PATCH] Add IOInterface methods --- src/Composer/IO/IOInterface.php | 18 ++++++++++++++++++ src/Composer/Util/ProcessExecutor.php | 14 +++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/Composer/IO/IOInterface.php b/src/Composer/IO/IOInterface.php index 95f891c57..0ba1cf932 100644 --- a/src/Composer/IO/IOInterface.php +++ b/src/Composer/IO/IOInterface.php @@ -81,6 +81,24 @@ interface IOInterface extends LoggerInterface */ public function writeError($messages, $newline = true, $verbosity = self::NORMAL); + /** + * Writes a message to the output, without formatting it. + * + * @param string|array $messages The message as an array of lines or a single string + * @param bool $newline Whether to add a newline or not + * @param int $verbosity Verbosity level from the VERBOSITY_* constants + */ + public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL); + + /** + * Writes a message to the error output, without formatting it. + * + * @param string|array $messages The message as an array of lines or a single string + * @param bool $newline Whether to add a newline or not + * @param int $verbosity Verbosity level from the VERBOSITY_* constants + */ + public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL); + /** * Overwrites a previous message to the output. * diff --git a/src/Composer/Util/ProcessExecutor.php b/src/Composer/Util/ProcessExecutor.php index 83f19cf2d..c16953652 100644 --- a/src/Composer/Util/ProcessExecutor.php +++ b/src/Composer/Util/ProcessExecutor.php @@ -112,18 +112,10 @@ class ProcessExecutor return; } - if (method_exists($this->io, 'writeRaw')) { - if (Process::ERR === $type) { - $this->io->writeErrorRaw($buffer, false); - } else { - $this->io->writeRaw($buffer, false); - } + if (Process::ERR === $type) { + $this->io->writeErrorRaw($buffer, false); } else { - if (Process::ERR === $type) { - $this->io->writeError($buffer, false); - } else { - $this->io->write($buffer, false); - } + $this->io->writeRaw($buffer, false); } }