Skip to content
Open
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
25 changes: 18 additions & 7 deletions lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,17 @@
public function hasKey(string $app, string $key, ?bool $lazy = false): bool {
$this->assertParams($app, $key);
$this->loadConfig($app, $lazy ?? true);
$this->matchAndApplyLexiconDefinition($app, $key);
$lexiconEntry = null;
$this->matchAndApplyLexiconDefinition($app, $key, lexiconEntry: $lexiconEntry);

if (!$lazy && $lexiconEntry?->isLazy() ?? false) {

Check failure on line 184 in lib/private/AppConfig.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidArgument

lib/private/AppConfig.php:184:7: InvalidArgument: Isset only works with variables and array elements (see https://psalm.dev/004)
// using updateLazy() will load lazy cache but also fix the lazy
// flag in the database if needed. Still Light if no changes are needed
$lazy = true;
if ($this->updateLazy($app, $key, true)) {
$this->loadConfig($app, true);
}
}

$hasLazy = isset($this->lazyCache[$app][$key]);
$hasFast = isset($this->fastCache[$app][$key]);
Expand Down Expand Up @@ -227,13 +237,13 @@
$this->assertParams($app, $key);
$this->matchAndApplyLexiconDefinition($app, $key);

// there is a huge probability the non-lazy config are already loaded
if ($this->hasKey($app, $key, false)) {
$this->loadConfig($app, false);
if (isset($this->fastCache[$app][$key])) {
return false;
}

// key not found, we search in the lazy config
if ($this->hasKey($app, $key, true)) {
$this->loadConfig($app, true);
if (isset($this->lazyCache[$app][$key])) {
return true;
}

Expand Down Expand Up @@ -1782,13 +1792,14 @@
return $this->applyLexiconStrictness($configDetails['strictness'], $app . '/' . $key);
}

/** @var Entry $lexiconEntry */
$lexiconEntry = $configDetails['entries'][$key];

// if lazy is NULL, we ignore all check on the type/lazyness/default from Lexicon
if ($lazy === null) {
return true;
}

/** @var Entry $lexiconEntry */
$lexiconEntry = $configDetails['entries'][$key];
$type &= ~self::VALUE_SENSITIVE;

$appConfigValueType = $lexiconEntry->getValueType()->toAppConfigFlag();
Expand Down
Loading