We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea0863a commit 2d4bd57Copy full SHA for 2d4bd57
src/Services/Formatter.php
@@ -41,6 +41,10 @@ public function setSimple(): void
41
42
public function raw(array $array, int $pad = 1): string
43
{
44
+ if (empty($array)) {
45
+ return '[]';
46
+ }
47
+
48
$array = $this->convertKeysCase($array);
49
50
$keys_size = $this->sizeKeys($array);
tests/FormatterRawTest.php
@@ -30,4 +30,13 @@ public function testStoreNotString()
30
$formatted . PHP_EOL
31
);
32
}
33
34
+ public function testEmptyArray()
35
+ {
36
+ $service = $this->service();
37
38
+ $formatted = $service->raw([]);
39
40
+ $this->assertSame('[]', $formatted);
0 commit comments