diff --git a/Formatter/OutputFormatter.php b/Formatter/OutputFormatter.php index 5d52896ac..26288ce62 100644 --- a/Formatter/OutputFormatter.php +++ b/Formatter/OutputFormatter.php @@ -25,6 +25,14 @@ class OutputFormatter implements WrappableOutputFormatterInterface private $styles = []; private $styleStack; + public function __clone() + { + $this->styleStack = clone $this->styleStack; + foreach ($this->styles as $key => $value) { + $this->styles[$key] = clone $value; + } + } + /** * Escapes "<" special char in given text. * diff --git a/Tests/Fixtures/Style/SymfonyStyle/command/command_20.php b/Tests/Fixtures/Style/SymfonyStyle/command/command_20.php new file mode 100644 index 000000000..6b47969ee --- /dev/null +++ b/Tests/Fixtures/Style/SymfonyStyle/command/command_20.php @@ -0,0 +1,13 @@ +setDecorated(true); + $output = new SymfonyStyle($input, $output); + $output->write('do you want something'); + $output->writeln('?'); +}; diff --git a/Tests/Fixtures/Style/SymfonyStyle/output/output_20.txt b/Tests/Fixtures/Style/SymfonyStyle/output/output_20.txt new file mode 100644 index 000000000..c08298530 --- /dev/null +++ b/Tests/Fixtures/Style/SymfonyStyle/output/output_20.txt @@ -0,0 +1 @@ +do you want something?