From 169b187ca532b709dd91ae3142f5b88498815fff Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 6 Nov 2024 20:43:45 +0100 Subject: [PATCH] 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. --- src/Generators/Text.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Generators/Text.php b/src/Generators/Text.php index c97f16afdb..47eefcaa04 100644 --- a/src/Generators/Text.php +++ b/src/Generators/Text.php @@ -220,15 +220,8 @@ private function linesToTableRows(array $column1Lines, array $column2Lines) $rows = ''; for ($i = 0; $i < $maxLines; $i++) { - $column1Text = ''; - if (isset($column1Lines[$i]) === true) { - $column1Text = $column1Lines[$i]; - } - - $column2Text = ''; - if (isset($column2Lines[$i]) === true) { - $column2Text = $column2Lines[$i]; - } + $column1Text = ($column1Lines[$i] ?? ''); + $column2Text = ($column2Lines[$i] ?? ''); $rows .= '| '; $rows .= $column1Text.str_repeat(' ', max(0, (47 - strlen($column1Text))));