Skip to content

Commit

Permalink
combined two condition into one in stringify function
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-xz committed Feb 27, 2024
1 parent 0a72397 commit 74af4a2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Formatters/Stylish.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@

function stringify(mixed $item, int $depth, int $offset = 2, string $separator = ' '): string
{
if (is_string($item)) {
return $item;
} elseif (!is_array($item)) {
$itemString = var_export($item, true);
if (!is_array($item)) {
$itemString = is_string($item) ? $item : var_export($item, true);
return $itemString === 'NULL' ? 'null' : $itemString;
}
$emptySpace = str_repeat($separator, $depth);
Expand Down

0 comments on commit 74af4a2

Please sign in to comment.