From 44c32c171190b7598c531edb5620e715aa389621 Mon Sep 17 00:00:00 2001 From: sunxyw Date: Tue, 15 Nov 2022 23:14:31 +0800 Subject: [PATCH] fix styles --- src/ZM/Exception/ConfigException.php | 4 ++-- src/ZM/Exception/InitException.php | 4 +--- src/ZM/Exception/ZMException.php | 4 +--- src/ZM/Exception/ZMKnownException.php | 4 ++-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/ZM/Exception/ConfigException.php b/src/ZM/Exception/ConfigException.php index 6909d703..86233125 100644 --- a/src/ZM/Exception/ConfigException.php +++ b/src/ZM/Exception/ConfigException.php @@ -12,11 +12,11 @@ class ConfigException extends ZMException public static function unsupportedFileType(string $file_path): ConfigException { - return new self("不支持的配置文件类型:{$file_path}", "请检查配置文件的后缀名是否正确", self::UNSUPPORTED_FILE_TYPE); + return new self("不支持的配置文件类型:{$file_path}", '请检查配置文件的后缀名是否正确', self::UNSUPPORTED_FILE_TYPE); } public static function loadConfigFailed(string $file_path, string $message): ConfigException { - return new self("加载配置文件失败:{$file_path},{$message}", "请检查配置文件的格式是否正确,并尝试按照错误信息排查", self::LOAD_CONFIG_FAILED); + return new self("加载配置文件失败:{$file_path},{$message}", '请检查配置文件的格式是否正确,并尝试按照错误信息排查', self::LOAD_CONFIG_FAILED); } } diff --git a/src/ZM/Exception/InitException.php b/src/ZM/Exception/InitException.php index fed7146c..538bf743 100644 --- a/src/ZM/Exception/InitException.php +++ b/src/ZM/Exception/InitException.php @@ -4,11 +4,9 @@ declare(strict_types=1); namespace ZM\Exception; -use Throwable; - class InitException extends ZMException { - public function __construct(string $message = '', int $code = 0, ?Throwable $previous = null) + public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null) { // TODO: change this to a better error message parent::__construct($message, '', $code, $previous); diff --git a/src/ZM/Exception/ZMException.php b/src/ZM/Exception/ZMException.php index 35e43ac2..67abda11 100644 --- a/src/ZM/Exception/ZMException.php +++ b/src/ZM/Exception/ZMException.php @@ -4,11 +4,9 @@ declare(strict_types=1); namespace ZM\Exception; -use Throwable; - abstract class ZMException extends \Exception { - public function __construct(string $description, string $solution = '', int $code = 0, ?Throwable $previous = null) + public function __construct(string $description, string $solution = '', int $code = 0, ?\Throwable $previous = null) { parent::__construct($description . PHP_EOL . $solution, $code, $previous); } diff --git a/src/ZM/Exception/ZMKnownException.php b/src/ZM/Exception/ZMKnownException.php index 28e0d310..c514b9ef 100644 --- a/src/ZM/Exception/ZMKnownException.php +++ b/src/ZM/Exception/ZMKnownException.php @@ -14,10 +14,10 @@ class ZMKnownException extends ZMException parent::__construct(zm_internal_errcode($err_code) . $message, $code, $previous); if ($err_code === 'E99999') { $code = 0; - // 这也太懒了吧 + // 这也太懒了吧 } else { // 取最后两数 - $code = (int)substr($err_code, -2); + $code = (int) substr($err_code, -2); } parent::__construct($message, '', $code, $previous); }