Skip to content

Commit

Permalink
Fix console closing tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jderusse committed Nov 25, 2020
1 parent 95f70e6 commit 05240f0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Formatter/OutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
13 changes: 13 additions & 0 deletions Tests/Fixtures/Style/SymfonyStyle/command/command_20.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

// Ensure that closing tag is applied once
return function (InputInterface $input, OutputInterface $output) {
$output->setDecorated(true);
$output = new SymfonyStyle($input, $output);
$output->write('<question>do you want <comment>something</>');
$output->writeln('?</>');
};
1 change: 1 addition & 0 deletions Tests/Fixtures/Style/SymfonyStyle/output/output_20.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
do you want something?

0 comments on commit 05240f0

Please sign in to comment.