diff --git a/app/Controller/Api/V1/ContactsController.php b/app/Controller/Api/V1/ContactsController.php index fe91d36..8e72a84 100644 --- a/app/Controller/Api/V1/ContactsController.php +++ b/app/Controller/Api/V1/ContactsController.php @@ -129,7 +129,7 @@ class ContactsController extends CController ]); $user_id = $this->uid(); - $isTrue = $this->service->editRemark($user_id, intval($params['friend_id']), $params['remarks']); + $isTrue = $this->service->editRemark($user_id, intval($params['friend_id']), $params['remarks']); if (!$isTrue) { return $this->response->fail('备注修改失败!'); } diff --git a/app/Traits/PagingTrait.php b/app/Traits/PagingTrait.php index c70c7ac..8eacce0 100644 --- a/app/Traits/PagingTrait.php +++ b/app/Traits/PagingTrait.php @@ -17,9 +17,9 @@ trait PagingTrait * @param int $page_size 分页大小 * @return int 分页总数 */ - protected function getPagingTotal(int $total, int $page_size) + protected function getPagingTotal(int $total, int $page_size): int { - return ($total === 0) ? 0 : (int)ceil((int)$total / (int)$page_size); + return ($total === 0) ? 0 : (int)ceil($total / $page_size); } /** @@ -32,7 +32,7 @@ trait PagingTrait * @param array $params 额外参数 * @return array */ - protected function getPagingRows(array $rows, int $total, int $page, int $page_size, array $params = []) + protected function getPagingRows(array $rows, int $total, int $page, int $page_size, array $params = []): array { return array_merge([ 'rows' => $rows, diff --git a/app/Traits/StaticInstance.php b/app/Traits/StaticInstance.php index 71fc89b..3492379 100644 --- a/app/Traits/StaticInstance.php +++ b/app/Traits/StaticInstance.php @@ -1,4 +1,5 @@ get(LoggerFactory::class)->get($name); } @@ -190,7 +192,7 @@ function get_media_url(string $path) * @param array $filesize 图片文件大小信息 * @return string */ -function create_image_name(string $ext, array $filesize) +function create_image_name(string $ext, array $filesize): string { return uniqid() . Str::random() . '_' . $filesize[0] . 'x' . $filesize[1] . '.' . $ext; } @@ -277,7 +279,7 @@ function push_redis_subscribe(string $chan, $message) * @param string $ext 文件后缀名 * @return string */ -function create_random_filename(string $ext) +function create_random_filename(string $ext): string { $ext = $ext ? '.' . $ext : ''; return Str::random(10) . uniqid() . $ext;