Apply suggestions from code review

Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
This commit is contained in:
Philipp 2023-01-02 02:25:41 +01:00 committed by Philipp
parent 5ff1d431aa
commit ae1533e312
Signed by: nupplaPhil
GPG Key ID: 24A7501396EB5432
3 changed files with 6 additions and 11 deletions

View File

@ -32,9 +32,7 @@ use Friendica\Core\Config\ValueObject\Cache;
*/
class Config implements IManageConfigValues
{
/**
* @var Cache
*/
/** @var Cache */
protected $configCache;
/** @var ConfigFileManager */

View File

@ -401,7 +401,7 @@ class ConfigFileManager
private function loadConfigFile(string $filepath): array
{
if (file_exists($filepath)) {
$config = include($filepath);
$config = include $filepath;
if (!is_array($config)) {
throw new ConfigFileException('Error loading config file ' . $filepath);

View File

@ -212,13 +212,10 @@ class Cache
return null;
}
switch (true) {
// manage array value
case preg_match("|^a:[0-9]+:{.*}$|s", $value):
return unserialize($value);
default:
return $value;
if (preg_match("|^a:[0-9]+:{.*}$|s", $value)) {
return unserialize($value);
} else {
return $value;
}
}