Skip to content

Commit

Permalink
Merge pull request #41 from adbario/fix/empty-constructor-parsing
Browse files Browse the repository at this point in the history
Fix parsing empty constructor array
  • Loading branch information
adbario committed Feb 12, 2023
2 parents 61860f3 + 690bd2e commit 33838e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Dot.php
Expand Up @@ -36,7 +36,7 @@ class Dot implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable
*
* @var array<TKey, TValue>
*/
protected $items;
protected $items = [];

/**
* The character to use as a delimiter, defaults to dot (.)
Expand Down
4 changes: 4 additions & 0 deletions tests/DotTest.php
Expand Up @@ -59,6 +59,10 @@ public function testConstructWithParsing(): void
$dot = new Dot(['foo.bar' => 'baz'], true);

$this->assertEquals(['foo' => ['bar' => 'baz']], $dot->get());

$dot = new Dot([], true);

$this->assertEquals([], $dot->get());
}

public function testConstructWithCustomDelimiter(): void
Expand Down

0 comments on commit 33838e3

Please sign in to comment.