Making PHPStan happy
This commit is contained in:
parent
41ba734090
commit
60d097a4d9
|
@ -324,7 +324,7 @@ function config_fetch_ex(
|
||||||
$includes_map_file = $includes_map_file ? $includes_map_file : config_get_includes_map_path();
|
$includes_map_file = $includes_map_file ? $includes_map_file : config_get_includes_map_path();
|
||||||
$includes_map = config_load_includes_map($includes_map_file);
|
$includes_map = config_load_includes_map($includes_map_file);
|
||||||
|
|
||||||
$chunk_size = ceil(sizeof($files)/$max_workers);
|
$chunk_size = (int)ceil(sizeof($files)/$max_workers);
|
||||||
$jobs = array();
|
$jobs = array();
|
||||||
foreach(array_chunk($files, $chunk_size) as $idx => $chunk_files)
|
foreach(array_chunk($files, $chunk_size) as $idx => $chunk_files)
|
||||||
$jobs[] = array($idx, $chunk_files);
|
$jobs[] = array($idx, $chunk_files);
|
||||||
|
@ -497,7 +497,6 @@ function config_find_by_alias(ConfigFetchResult $cache_entries, $strid) : Config
|
||||||
if(array_key_exists($strid, $cache_entries->by_alias))
|
if(array_key_exists($strid, $cache_entries->by_alias))
|
||||||
return $cache_entries->by_alias[$strid];
|
return $cache_entries->by_alias[$strid];
|
||||||
throw new Exception("Failed to find config by alias '$strid'!");
|
throw new Exception("Failed to find config by alias '$strid'!");
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function config_find_by_id(ConfigFetchResult $cache_entries, $id) : ConfigCacheEntry
|
function config_find_by_id(ConfigFetchResult $cache_entries, $id) : ConfigCacheEntry
|
||||||
|
@ -505,7 +504,6 @@ function config_find_by_id(ConfigFetchResult $cache_entries, $id) : ConfigCacheE
|
||||||
if(array_key_exists($id, $cache_entries->by_id))
|
if(array_key_exists($id, $cache_entries->by_id))
|
||||||
return $cache_entries->by_id[$id];
|
return $cache_entries->by_id[$id];
|
||||||
throw new Exception("Failed to find config by id '$id'!");
|
throw new Exception("Failed to find config by id '$id'!");
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function config_find_by_path(ConfigFetchResult $cache_entries, $path) : ConfigCacheEntry
|
function config_find_by_path(ConfigFetchResult $cache_entries, $path) : ConfigCacheEntry
|
||||||
|
@ -513,20 +511,19 @@ function config_find_by_path(ConfigFetchResult $cache_entries, $path) : ConfigCa
|
||||||
if(array_key_exists($path, $cache_entries->by_path))
|
if(array_key_exists($path, $cache_entries->by_path))
|
||||||
return $cache_entries->by_path[$path];
|
return $cache_entries->by_path[$path];
|
||||||
throw new Exception("Failed to find config by path '$path'!");
|
throw new Exception("Failed to find config by path '$path'!");
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function config_fetch_by_path(string $path, $force_stale = false, $use_cache = true, $includes_map_file = null) : ConfigCacheEntry
|
function config_fetch_by_path(string $path, $force_stale = false) : ConfigCacheEntry
|
||||||
{
|
{
|
||||||
$ces = config_fetch_ex(array($path), $force_stale, $verbose = false, $includes_map_file, null, $use_cache);
|
$ces = config_fetch_ex(array($path), $force_stale);
|
||||||
if(!$ces)
|
if(!$ces)
|
||||||
throw new Exception("Config not found at path '$path'");
|
throw new Exception("Config not found at path '$path'");
|
||||||
return $ces->all[0];
|
return $ces->all[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function config_fetch_all($force_stale = false, $use_cache = true, $includes_map_file = null)
|
function config_fetch_all($force_stale = false)
|
||||||
{
|
{
|
||||||
return config_fetch_ex(config_scan_files(), $force_stale, $verbose = false, $includes_map_file, null, $use_cache);
|
return config_fetch_ex(config_scan_files(), $force_stale);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConfigCacheEntryExtras
|
class ConfigCacheEntryExtras
|
||||||
|
@ -556,6 +553,10 @@ class ConfigCacheEntryExtras
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property object $config
|
||||||
|
* @property string $payload
|
||||||
|
*/
|
||||||
class ConfigCacheEntry
|
class ConfigCacheEntry
|
||||||
{
|
{
|
||||||
const FMT_BINARY = 0;
|
const FMT_BINARY = 0;
|
||||||
|
|
Loading…
Reference in New Issue