You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm registering a table with this (simplified) code:
$table = new \cli\Table();
$ascii = new \cli\table\Ascii();
$widths = [
3, // this is the longest default date format: [24-Sep-2023 20:50:51 UTC]3, // this is the longest default type: PHP Fatal error5, // trigger the overflow and last column max width by defining a very long string length
];
$ascii->setWidths( $widths );
$table->setRenderer( $ascii );
$table->setHeaders( [ 'one', 'two', 'three' ] );
$table->display();
Method Table::() returns this data:
array:4 [▶
0 => "+----------------------------+-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+"
1 => "| One | Two | Three |"
2 => "+----------------------------+-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+"
3 => "+----------------------------+-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+"
]
As you can see, array values for 2 and 3 are the same - bottom border.
This is because I output just the table, without rows (I plan to use ->addRow() later). And because this code in this library:
Bug Report
Describe the current, buggy behavior
I'm registering a table with this (simplified) code:
Method Table::() returns this data:
As you can see, array values for 2 and 3 are the same - bottom border.
This is because I output just the table, without rows (I plan to use
->addRow()
later). And because this code in this library:Does not check whether rows is actually not empty.
Describe what you would expect as the correct outcome
If there is a header but no rows - we should display only 1 border.
Let us know what environment you are running this on
Provide a possible solution
I will create a PR.
The text was updated successfully, but these errors were encountered: