fix code to phpstan-level-2

This commit is contained in:
crazywhalecc
2022-04-02 23:37:22 +08:00
committed by Jerry Ma
parent be9874a9ad
commit eecbe49955
31 changed files with 450 additions and 384 deletions

View File

@@ -24,11 +24,11 @@ class LightCache
private static $config = [];
/**
* @param $config
* @param array $config 配置
* @throws Exception
* @return bool|mixed
* @return bool|mixed 返回失败false或创建SwooleTable成功结果
*/
public static function init($config)
public static function init(array $config)
{
self::$config = $config;
self::$kv_table = new Table($config['size'], $config['hash_conflict_proportion']);
@@ -169,7 +169,7 @@ class LightCache
}
/**
* @param $value
* @param mixed $value
* @throws ZMException
* @return bool
*/

View File

@@ -38,8 +38,7 @@ class LightCacheInside
}
/**
* @param array|int|string $value
* @return mixed
* @param array|int|string $value
*/
public static function set(string $table, string $key, $value): bool
{
@@ -58,13 +57,10 @@ class LightCacheInside
}
/**
* @param $name
* @param $size
* @param $str_size
* @param int $conflict_proportion
* @param float|int $conflict_proportion
* @throws ZMException
*/
private static function createTable($name, $size, $str_size, $conflict_proportion = 0)
private static function createTable(string $name, int $size, int $str_size, $conflict_proportion = 0)
{
self::$kv_table[$name] = new Table($size, $conflict_proportion);
self::$kv_table[$name]->column('value', Table::TYPE_STRING, $str_size);

View File

@@ -12,10 +12,7 @@ class ZMAtomic
/** @var Atomic[] */
public static $atomics;
/**
* @param $name
*/
public static function get($name): ?Atomic
public static function get(string $name): ?Atomic
{
return self::$atomics[$name] ?? null;
}