8000 [Console] Decouple SymfonyStyle from TableCell · symfony/symfony@51f59d6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 51f59d6

Browse files
ro0NLfabpot
authored andcommitted
[Console] Decouple SymfonyStyle from TableCell
1 parent fad545a commit 51f59d6

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/Symfony/Component/Console/Style/SymfonyStyle.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\Console\Helper\ProgressBar;
1818
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
1919
use Symfony\Component\Console\Helper\Table;
20-
use Symfony\Component\Console\Helper\TableCell;
2120
use Symfony\Component\Console\Input\InputInterface;
2221
use Symfony\Component\Console\Output\BufferedOutput;
2322
use Symfony\Component\Console\Output\OutputInterface;
@@ -218,21 +217,13 @@ public function caution($message)
218217
*/
219218
public function table(array $headers, array $rows)
220219
{
221-
array_walk_recursive($headers, function (&$value) {
222-
if ($value instanceof TableCell) {
223-
$value = new TableCell(sprintf('<info>%s</>', $value), array(
224-
'colspan' => $value->getColspan(),
225-
'rowspan' => $value->getRowspan(),
226-
));
227-
} else {
228-
$value = sprintf('<info>%s</>', $value);
229-
}
230-
});
220+
$style = clone Table::getStyleDefinition('symfony-style-guide');
221+
$style->setCellHeaderFormat('<info>%s</info>');
231222

232223
$table = new Table($this);
233224
$table->setHeaders($headers);
234225
$table->setRows($rows);
235-
$table->setStyle('symfony-style-guide');
226+
$table->setStyle($style);
236227

237228
$table->render();
238229
$this->newLine();

0 commit comments

Comments
 (0)
0