Skip to content

Commit 68cfed5

Browse files
Merge branch '4.1'
* 4.1: [Debug] Fix false-positive "MicroKernelTrait::loadRoutes()" method is considered internal" [Console] Fixed boxed table style with colspan parse numbers terminated with decimal separator fail reverse transforming invalid RFC 3339 dates
2 parents c5ca555 + d7d1b29 commit 68cfed5

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

Helper/Table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,13 +717,13 @@ private function calculateColumnsWidth(iterable $rows)
717717
$lengths[] = $this->getCellWidth($row, $column);
718718
}
719719

720-
$this->effectiveColumnWidths[$column] = max($lengths) + \strlen($this->style->getCellRowContentFormat()) - 2;
720+
$this->effectiveColumnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
721721
}
722722
}
723723

724724
private function getColumnSeparatorWidth(): int
725725
{
726-
return \strlen(sprintf($this->style->getBorderFormat(), $this->style->getBorderChars()[3]));
726+
return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getBorderChars()[3]));
727727
}
728728

729729
private function getCellWidth(array $row, int $column): int

Tests/Helper/TableTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,42 @@ public function testColumnMaxWidths()
10771077
$this->assertEquals($expected, $this->getOutputContent($output));
10781078
}
10791079

1080+
public function testBoxedStyleWithColspan()
1081+
{
1082+
$boxed = new TableStyle();
1083+
$boxed
1084+
->setHorizontalBorderChars('')
1085+
->setVerticalBorderChars('')
1086+
->setCrossingChars('', '', '', '', '', '', '', '', '')
1087+
;
1088+
1089+
$table = new Table($output = $this->getOutputStream());
1090+
$table->setStyle($boxed);
1091+
$table
1092+
->setHeaders(array('ISBN', 'Title', 'Author'))
1093+
->setRows(array(
1094+
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
1095+
new TableSeparator(),
1096+
array(new TableCell('This value spans 3 columns.', array('colspan' => 3))),
1097+
))
1098+
;
1099+
$table->render();
1100+
1101+
$expected =
1102+
<<<TABLE
1103+
┌───────────────┬───────────────┬─────────────────┐
1104+
│ ISBN │ Title │ Author │
1105+
├───────────────┼───────────────┼─────────────────┤
1106+
│ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri │
1107+
├───────────────┼───────────────┼─────────────────┤
1108+
│ This value spans 3 columns. │
1109+
└───────────────┴───────────────┴─────────────────┘
1110+
1111+
TABLE;
1112+
1113+
$this->assertSame($expected, $this->getOutputContent($output));
1114+
}
1115+
10801116
protected function getOutputStream($decorated = false)
10811117
{
10821118
return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, $decorated);

0 commit comments

Comments
 (0)