returns default on exception

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
Maxence Lange 2024-01-16 12:35:05 -01:00
parent 5f0c406e42
commit addd678682

View file

@ -292,11 +292,17 @@ class AppConfig implements IAppConfig {
string $default = '',
?bool $lazy = false
): string {
try {
$lazy = ($lazy === null) ? $this->isLazy($app, $key) : $lazy;
} catch (AppConfigUnknownKeyException $e) {
return $default;
}
return $this->getTypedValue(
$app,
$key,
$default,
($lazy === null) ? $this->isLazy($app, $key) : $lazy,
$lazy,
self::VALUE_MIXED
);
}