From 0d2fe9af88b6cdb0c07c2602ebbe94f2a328c74f Mon Sep 17 00:00:00 2001 From: omniError Date: Thu, 9 Mar 2023 23:30:23 -0600 Subject: [PATCH 1/5] Fix fatal error when root is null in has() method fixes #159 --- src/AbstractConfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AbstractConfig.php b/src/AbstractConfig.php index 5932eda..340ddf4 100644 --- a/src/AbstractConfig.php +++ b/src/AbstractConfig.php @@ -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 { From 61dbbac75ccfd990925a852d45fd2ada9e2b0532 Mon Sep 17 00:00:00 2001 From: omniError Date: Sun, 12 Mar 2023 14:04:26 -0500 Subject: [PATCH 2/5] improve test --- tests/AbstractConfigTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/AbstractConfigTest.php b/tests/AbstractConfigTest.php index 551d246..e0fe945 100644 --- a/tests/AbstractConfigTest.php +++ b/tests/AbstractConfigTest.php @@ -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')); } /** From dc59281bc2ef08faef84e5a8990eacfef33c0ab5 Mon Sep 17 00:00:00 2001 From: 8ctopus Date: Wed, 4 Dec 2024 16:34:29 +0400 Subject: [PATCH 3/5] Fix php 8.4 deprecations implicitly marking parameter as nullable is deprecated --- src/Config.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Config.php b/src/Config.php index 8838e44..dad3b67 100644 --- a/src/Config.php +++ b/src/Config.php @@ -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); @@ -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 = []; @@ -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 From fbecfc2acdc29717b17f8d960dc9d93477f74b50 Mon Sep 17 00:00:00 2001 From: Davide Pastore Date: Mon, 9 Dec 2024 16:31:05 +0100 Subject: [PATCH 4/5] Update continuous-integration.yml Add PHP 8.3 and 8.4 to the CI matrix --- .github/workflows/continuous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 6077d60..4d4da05 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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 @@ -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 \ No newline at end of file + run: php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover From aba699e71d16d50c838f8faadfb496c2cf143277 Mon Sep 17 00:00:00 2001 From: Davide Pastore Date: Mon, 9 Dec 2024 16:12:03 +0000 Subject: [PATCH 5/5] Add release notes for 3.2.0 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f04acd0..6029a6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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