Skip to content

Commit 169b187

Browse files
committed
Modernize: use null coalesce
There's bound to be more places where this can be used, but this was the only one I've come across in the past six months which was an obvious one.
1 parent b8d295e commit 169b187

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/Generators/Text.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,8 @@ private function linesToTableRows(array $column1Lines, array $column2Lines)
220220

221221
$rows = '';
222222
for ($i = 0; $i < $maxLines; $i++) {
223-
$column1Text = '';
224-
if (isset($column1Lines[$i]) === true) {
225-
$column1Text = $column1Lines[$i];
226-
}
227-
228-
$column2Text = '';
229-
if (isset($column2Lines[$i]) === true) {
230-
$column2Text = $column2Lines[$i];
231-
}
223+
$column1Text = ($column1Lines[$i] ?? '');
224+
$column2Text = ($column2Lines[$i] ?? '');
232225

233226
$rows .= '| ';
234227
$rows .= $column1Text.str_repeat(' ', max(0, (47 - strlen($column1Text))));

0 commit comments

Comments
 (0)