Skip to content

Commit cf63da4

Browse files
Merge pull request #167 from hassankhan/develop
Release 3.2.0
2 parents 8e1c07f + 65bcf59 commit cf63da4

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
operating-system: [ubuntu-latest]
11-
php-versions: ['7.4', '8.0', '8.1', '8.2']
11+
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
1212
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
1313
steps:
1414
- uses: actions/checkout@v3
@@ -33,4 +33,4 @@ jobs:
3333

3434
- name: Upload code coverage data
3535
if: ${{ matrix.php-versions == '7.4' }}
36-
run: php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
36+
run: php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

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

5+
## 3.2.0 - 2024-12-09
6+
7+
### Added
8+
* PHP 8.3 and 8.4 to the build matrix (#164)
9+
10+
### Fixed
11+
* Fatal error when root is null in has() method (#159 and #160)
12+
* PHP 8.4 deprecations implicitly marking parameter as nullable is deprecated (#163)
13+
14+
515
## 3.1.0 - 2022-12-20
616

717
### Added

src/AbstractConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function has($key)
123123

124124
// nested case
125125
foreach ($segments as $segment) {
126-
if (array_key_exists($segment, $root)) {
126+
if (is_array($root) && array_key_exists($segment, $root)) {
127127
$root = $root[$segment];
128128
continue;
129129
} else {

src/Config.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ public static function load($values, $parser = null, $string = false)
6767
* Loads a Config instance.
6868
*
6969
* @param string|array $values Filenames or string with configuration
70-
* @param ParserInterface $parser Configuration parser
70+
* @param ?ParserInterface $parser Configuration parser
7171
* @param bool $string Enable loading from string
7272
*/
73-
public function __construct($values, ParserInterface $parser = null, $string = false)
73+
public function __construct($values, ?ParserInterface $parser = null, $string = false)
7474
{
7575
if ($string === true) {
7676
$this->loadFromString($values, $parser);
@@ -85,11 +85,11 @@ public function __construct($values, ParserInterface $parser = null, $string = f
8585
* Loads configuration from file.
8686
*
8787
* @param string|array $path Filenames or directories with configuration
88-
* @param ParserInterface $parser Configuration parser
88+
* @param ?ParserInterface $parser Configuration parser
8989
*
9090
* @throws EmptyDirectoryException If `$path` is an empty directory
9191
*/
92-
protected function loadFromFile($path, ParserInterface $parser = null)
92+
protected function loadFromFile($path, ?ParserInterface $parser = null)
9393
{
9494
$paths = $this->getValidPath($path);
9595
$this->data = [];
@@ -125,11 +125,11 @@ protected function loadFromFile($path, ParserInterface $parser = null)
125125
* Writes configuration to file.
126126
*
127127
* @param string $filename Filename to save configuration to
128-
* @param WriterInterface $writer Configuration writer
128+
* @param ?WriterInterface $writer Configuration writer
129129
*
130130
* @throws WriteException if the data could not be written to the file
131131
*/
132-
public function toFile($filename, WriterInterface $writer = null)
132+
public function toFile($filename, ?WriterInterface $writer = null)
133133
{
134134
if ($writer === null) {
135135
// Get file information

tests/AbstractConfigTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ public function testHasNestedKey()
247247
$this->assertTrue($this->config->has('application.runtime'));
248248
$this->assertFalse($this->config->has('application.not_exist'));
249249
$this->assertFalse($this->config->has('not_exist.name'));
250+
$this->assertFalse($this->config->has('application.name.not_exist'));
250251
}
251252

252253
/**

0 commit comments

Comments
 (0)