Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions system/Config/BaseConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ protected function registerProperties()
if (static::$discovering) {
throw new ConfigException(
'During Auto-Discovery of Registrars,'
. ' "' . static::class . '" executes Auto-Discovery again.'
. ' "' . clean_path(static::$registrarFile) . '" seems to have bad code.',
. ' "' . static::class . '" executes Auto-Discovery again.'
. ' "' . clean_path(static::$registrarFile) . '" seems to have bad code.',
);
}

Expand Down Expand Up @@ -291,7 +291,7 @@ protected function registerProperties()

foreach ($properties as $property => $value) {
if (isset($this->{$property}) && is_array($this->{$property}) && is_array($value)) {
$this->{$property} = array_merge($this->{$property}, $value);
$this->{$property} = array_merge_recursive($this->{$property}, $value);
} else {
$this->{$property} = $value;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/_support/Config/TestRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public static function RegistrarConfig()
'first',
'second',
],
'baz' => [
'bar' => 'ber',
],
];
}
}
3 changes: 3 additions & 0 deletions tests/system/Config/BaseConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ public function testRegistrars(): void
$this->assertSame('bar', $config->foo);
// add to an existing array property
$this->assertSame(['baz', 'first', 'second'], $config->bar);

// add to an existing nested array property
$this->assertSame(['foo', 'bar' => ['bir', 'bur', 'ber']], $config->baz);
}

public function testBadRegistrar(): void
Expand Down
7 changes: 7 additions & 0 deletions tests/system/Config/fixtures/RegistrarConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@
public $bar = [
'baz',
];
public array $baz = [

Check failure on line 22 in tests/system/Config/fixtures/RegistrarConfig.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis

Property RegistrarConfig::$baz type has no value type specified in iterable type array.
'foo',
'bar' => [
'bir',
'bur',
],
];
}
Loading