Skip to content

Commit

Permalink
Merge pull request #167 from hassankhan/develop
Browse files Browse the repository at this point in the history
Release 3.2.0
  • Loading branch information
DavidePastore authored Dec 9, 2024
2 parents 8e1c07f + 65bcf59 commit cf63da4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4', '8.0', '8.1', '8.2']
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
- uses: actions/checkout@v3
Expand All @@ -33,4 +33,4 @@ jobs:

- name: Upload code coverage data
if: ${{ matrix.php-versions == '7.4' }}
run: php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
run: php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to `Config` will be documented in this file

## 3.2.0 - 2024-12-09

### Added
* PHP 8.3 and 8.4 to the build matrix (#164)

### Fixed
* Fatal error when root is null in has() method (#159 and #160)
* PHP 8.4 deprecations implicitly marking parameter as nullable is deprecated (#163)


## 3.1.0 - 2022-12-20

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/AbstractConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function has($key)

// nested case
foreach ($segments as $segment) {
if (array_key_exists($segment, $root)) {
if (is_array($root) && array_key_exists($segment, $root)) {
$root = $root[$segment];
continue;
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public static function load($values, $parser = null, $string = false)
* Loads a Config instance.
*
* @param string|array $values Filenames or string with configuration
* @param ParserInterface $parser Configuration parser
* @param ?ParserInterface $parser Configuration parser
* @param bool $string Enable loading from string
*/
public function __construct($values, ParserInterface $parser = null, $string = false)
public function __construct($values, ?ParserInterface $parser = null, $string = false)
{
if ($string === true) {
$this->loadFromString($values, $parser);
Expand All @@ -85,11 +85,11 @@ public function __construct($values, ParserInterface $parser = null, $string = f
* Loads configuration from file.
*
* @param string|array $path Filenames or directories with configuration
* @param ParserInterface $parser Configuration parser
* @param ?ParserInterface $parser Configuration parser
*
* @throws EmptyDirectoryException If `$path` is an empty directory
*/
protected function loadFromFile($path, ParserInterface $parser = null)
protected function loadFromFile($path, ?ParserInterface $parser = null)
{
$paths = $this->getValidPath($path);
$this->data = [];
Expand Down Expand Up @@ -125,11 +125,11 @@ protected function loadFromFile($path, ParserInterface $parser = null)
* Writes configuration to file.
*
* @param string $filename Filename to save configuration to
* @param WriterInterface $writer Configuration writer
* @param ?WriterInterface $writer Configuration writer
*
* @throws WriteException if the data could not be written to the file
*/
public function toFile($filename, WriterInterface $writer = null)
public function toFile($filename, ?WriterInterface $writer = null)
{
if ($writer === null) {
// Get file information
Expand Down
1 change: 1 addition & 0 deletions tests/AbstractConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ public function testHasNestedKey()
$this->assertTrue($this->config->has('application.runtime'));
$this->assertFalse($this->config->has('application.not_exist'));
$this->assertFalse($this->config->has('not_exist.name'));
$this->assertFalse($this->config->has('application.name.not_exist'));
}

/**
Expand Down

0 comments on commit cf63da4

Please sign in to comment.