Skip to content

Commit

Permalink
Fixed default value returned in AbstractAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
ElGigi committed Apr 7, 2021
1 parent 2b912ff commit aa240d5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. This projec
to [Semantic Versioning] (http://semver.org/). For change log format,
use [Keep a Changelog] (http://keepachangelog.com/).

## [2.0.0-alpha3] - In progress
## [2.0.0-beta1] - In progress

### Added

Expand All @@ -19,6 +19,7 @@ use [Keep a Changelog] (http://keepachangelog.com/).

- Fixed null returned value
- Fixed returning type of ConfigFunction to mixed
- Fixed default value returned in `AbstractAdapter`

## [2.0.0-alpha2] - 2021-03-12

Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(int $priority = 0)
*/
public function get(string $key = null, mixed $default = null): mixed
{
return b_array_traverse_get($this->configuration, $key);
return b_array_traverse_get($this->configuration, $key, $default);
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/Adapter/ArrayAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function testLoadArray()
$this->assertEquals('value', $adapter->get('section.foo'));
$this->assertEquals('value2', $adapter->get('section.qux'));
$this->assertEquals(['bar' => 'value3'], $adapter->get('section2'));
$this->assertEquals('bar', $adapter->get('foo', 'bar'));

$this->assertFalse($adapter->has('baz'));
$this->assertTrue($adapter->has('section.foo'));
Expand Down
1 change: 1 addition & 0 deletions tests/Adapter/IniAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function testLoadString()
$this->assertEquals('value', $adapter->get('section.foo'));
$this->assertEquals('value2', $adapter->get('section.qux'));
$this->assertEquals(['bar' => 'value3'], $adapter->get('section2'));
$this->assertEquals('bar', $adapter->get('foo', 'bar'));
}

public function testLoadStringFailed()
Expand Down
1 change: 1 addition & 0 deletions tests/Adapter/JsonAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function testLoadString()
$this->assertEquals('value', $adapter->get('section.foo'));
$this->assertEquals('value2', $adapter->get('section.qux'));
$this->assertEquals(['bar' => 'value3'], $adapter->get('section2'));
$this->assertEquals('bar', $adapter->get('foo', 'bar'));

$this->assertFalse($adapter->has('baz'));
$this->assertTrue($adapter->has('section.foo'));
Expand Down

0 comments on commit aa240d5

Please sign in to comment.