source = $source; parent::__construct( $source->getStream(), $source->getVerbosity(), $source->isDecorated(), $source->getFormatter() ); } /** * {@inheritdoc} * * @param string|iterable $messages */ public function write($messages, $newline = false, $type = 0): void { $this->syncState(); parent::write($messages, $newline, $type); } /** * {@inheritdoc} */ public function getFormatter(): OutputFormatterInterface { $this->syncState(); return parent::getFormatter(); } /** * Keep formatter and display flags aligned with the shell output. */ private function syncState(): void { parent::setFormatter($this->source->getFormatter()); parent::setDecorated($this->source->isDecorated()); parent::setVerbosity($this->source->getVerbosity()); } }