From 317206fed9fb911ce9682bde949d8c49cd40e564 Mon Sep 17 00:00:00 2001 From: Lianbo Date: Mon, 2 Oct 2023 18:34:06 +0800 Subject: [PATCH] Use the latest container version (#15) * Use the latest container version * fix pint --- composer.json | 2 +- src/Support/Arr.php | 8 ++++---- src/Support/Encoder.php | 4 ++-- src/Support/FileConverter.php | 2 +- src/Support/Logger.php | 2 ++ src/Support/Response.php | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index bc8f927..41cb973 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "guzzlehttp/guzzle": "^7.2", "monolog/monolog": "^3.0", "psr/log": "^2.0 || ^3.0", - "godruoyi/easy-container": "^2.0", + "godruoyi/easy-container": "^2.0 || ^3.0", "psr/simple-cache": "^2.0 || ^3.0", "symfony/cache": "^6.1", "ext-json": "*" diff --git a/src/Support/Arr.php b/src/Support/Arr.php index 2172fe7..3448e07 100644 --- a/src/Support/Arr.php +++ b/src/Support/Arr.php @@ -142,7 +142,7 @@ public static function forget(&$array, $keys) $keys = (array) $keys; - if (0 === count($keys)) { + if (count($keys) === 0) { return; } @@ -195,7 +195,7 @@ public static function get($array, $key, $default = null) return $array[$key]; } - if (false === strpos($key, '.')) { + if (strpos($key, '.') === false) { return $array[$key] ?? self::vvalue($default); } @@ -364,7 +364,7 @@ public static function random($array, $number = null) return $array[array_rand($array)]; } - if (0 === (int) $number) { + if ((int) $number === 0) { return []; } @@ -398,7 +398,7 @@ public static function set(&$array, $key, $value) $keys = explode('.', $key); foreach ($keys as $i => $key) { - if (1 === count($keys)) { + if (count($keys) === 1) { break; } diff --git a/src/Support/Encoder.php b/src/Support/Encoder.php index 4db6822..ab102f1 100644 --- a/src/Support/Encoder.php +++ b/src/Support/Encoder.php @@ -20,7 +20,7 @@ class Encoder public static function getCanonicalHeaders(array $headers) { // 如果没有 headers,则返回空串 - if (0 == count($headers)) { + if (count($headers) == 0) { return ''; } @@ -31,7 +31,7 @@ public static function getCanonicalHeaders(array $headers) continue; } - $v = null === $v ? '' : $v; + $v = $v === null ? '' : $v; $headerStrings[] = strtolower(trim($k)).':'.strtolower(trim($v)); } diff --git a/src/Support/FileConverter.php b/src/Support/FileConverter.php index d54ab4f..2b4125d 100644 --- a/src/Support/FileConverter.php +++ b/src/Support/FileConverter.php @@ -93,7 +93,7 @@ public static function isString($file) */ public static function isUrl($file) { - return false !== filter_var($file, FILTER_VALIDATE_URL); + return filter_var($file, FILTER_VALIDATE_URL) !== false; } /** diff --git a/src/Support/Logger.php b/src/Support/Logger.php index fba87e8..766139b 100644 --- a/src/Support/Logger.php +++ b/src/Support/Logger.php @@ -11,6 +11,7 @@ namespace Godruoyi\OCR\Support; use function implode; + use Monolog\Formatter\LineFormatter; use Monolog\Handler\ErrorLogHandler; use Monolog\Handler\HandlerInterface; @@ -20,6 +21,7 @@ use Monolog\Handler\SyslogHandler; use Monolog\Logger as Monolog; use Psr\Log\LoggerInterface; + use function sprintf; class Logger implements LoggerInterface diff --git a/src/Support/Response.php b/src/Support/Response.php index a2ee4a8..2fccc6b 100644 --- a/src/Support/Response.php +++ b/src/Support/Response.php @@ -49,7 +49,7 @@ public function toArray(): array $response = json_decode($body, true); - if (JSON_ERROR_NONE != json_last_error()) { + if (json_last_error() != JSON_ERROR_NONE) { return []; }