exceptions on their own

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/42847/head
Maxence Lange 2024-01-16 12:48:27 +07:00
parent 5f0c406e42
commit db8636ac1a
1 changed files with 10 additions and 2 deletions

@ -164,7 +164,11 @@ class AppConfig implements IAppConfig {
$this->assertParams($app, $key);
$this->loadConfig($lazy);
return $this->isTyped(self::VALUE_SENSITIVE, $this->valueTypes[$app][$key] ?? throw new AppConfigUnknownKeyException('unknown config key'));
if (!isset($this->valueTypes[$app][$key])) {
throw new AppConfigUnknownKeyException('unknown config key');
}
return $this->isTyped(self::VALUE_SENSITIVE, $this->valueTypes[$app][$key]);
}
/**
@ -955,10 +959,14 @@ class AppConfig implements IAppConfig {
$typeString = (string)$type;
}
if (!isset($cache[$app][$key])) {
throw new AppConfigUnknownKeyException('unknown config key');
}
return [
'app' => $app,
'key' => $key,
'value' => $cache[$app][$key] ?? throw new AppConfigUnknownKeyException('unknown config key'),
'value' => $cache[$app][$key],
'type' => $type,
'lazy' => $lazy,
'typeString' => $typeString,