From a1a86f968d0f48c858049a9e72034f54db5e748d Mon Sep 17 00:00:00 2001 From: Ben Yan Date: Tue, 15 Feb 2022 16:55:41 +0800 Subject: [PATCH 1/4] Update psr/log Signed-off-by: Ben Yan --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5f022429..f6a8b475 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "psr/http-message": "^1.0", "psr/http-message-implementation": "^1.0", "psr/http-server-handler": "^1.0", - "psr/log": "^1.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", "symfony/console": "^5.0 || ^6.0", "webmozart/assert": "^1.9" }, From b2021cfa917a38c7033e867c0dc091ab301e547c Mon Sep 17 00:00:00 2001 From: Ben Yan Date: Tue, 15 Feb 2022 18:13:52 +0800 Subject: [PATCH 2/4] Regenerate content-hash of composer.json Signed-off-by: Ben Yan --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 0dd41238..a922eceb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1f14c198921f84d49af0d725e86788f0", + "content-hash": "6fe6b790d99a9fe4d4a92d3932d30550", "packages": [ { "name": "dflydev/fig-cookies", From f77c1b307c657085bf4e4a0ed075abfb566998b0 Mon Sep 17 00:00:00 2001 From: Ben Yan Date: Tue, 15 Feb 2022 19:56:54 +0800 Subject: [PATCH 3/4] Fix return type declaration Signed-off-by: Ben Yan --- src/Log/Psr3AccessLogDecorator.php | 18 +++++++++--------- src/Log/StdoutLogger.php | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Log/Psr3AccessLogDecorator.php b/src/Log/Psr3AccessLogDecorator.php index 65b9ce5f..f646220e 100644 --- a/src/Log/Psr3AccessLogDecorator.php +++ b/src/Log/Psr3AccessLogDecorator.php @@ -61,7 +61,7 @@ public function logAccessForPsr7Resource(Request $request, ResponseInterface $re /** * {@inheritDoc} */ - public function emergency($message, array $context = []) + public function emergency($message, array $context = []): void { $this->logger->emergency($message, $context); } @@ -69,7 +69,7 @@ public function emergency($message, array $context = []) /** * {@inheritDoc} */ - public function alert($message, array $context = []) + public function alert($message, array $context = []): void { $this->logger->alert($message, $context); } @@ -77,7 +77,7 @@ public function alert($message, array $context = []) /** * {@inheritDoc} */ - public function critical($message, array $context = []) + public function critical($message, array $context = []): void { $this->logger->critical($message, $context); } @@ -85,7 +85,7 @@ public function critical($message, array $context = []) /** * {@inheritDoc} */ - public function error($message, array $context = []) + public function error($message, array $context = []): void { $this->logger->error($message, $context); } @@ -93,7 +93,7 @@ public function error($message, array $context = []) /** * {@inheritDoc} */ - public function warning($message, array $context = []) + public function warning($message, array $context = []): void { $this->logger->warning($message, $context); } @@ -101,7 +101,7 @@ public function warning($message, array $context = []) /** * {@inheritDoc} */ - public function notice($message, array $context = []) + public function notice($message, array $context = []): void { $this->logger->notice($message, $context); } @@ -109,7 +109,7 @@ public function notice($message, array $context = []) /** * {@inheritDoc} */ - public function info($message, array $context = []) + public function info($message, array $context = []): void { $this->logger->info($message, $context); } @@ -117,7 +117,7 @@ public function info($message, array $context = []) /** * {@inheritDoc} */ - public function debug($message, array $context = []) + public function debug($message, array $context = []): void { $this->logger->debug($message, $context); } @@ -125,7 +125,7 @@ public function debug($message, array $context = []) /** * {@inheritDoc} */ - public function log($level, $message, array $context = []) + public function log($level, $message, array $context = []): void { $this->logger->log($level, $message, $context); } diff --git a/src/Log/StdoutLogger.php b/src/Log/StdoutLogger.php index 8a3110a6..37bff92e 100644 --- a/src/Log/StdoutLogger.php +++ b/src/Log/StdoutLogger.php @@ -33,7 +33,7 @@ class StdoutLogger implements LoggerInterface * @param string $message * @return void */ - public function emergency($message, array $context = []) + public function emergency($message, array $context = []): void { $this->log(LogLevel::EMERGENCY, $message, $context); } @@ -42,7 +42,7 @@ public function emergency($message, array $context = []) * @param string $message * @return void */ - public function alert($message, array $context = []) + public function alert($message, array $context = []): void { $this->log(LogLevel::ALERT, $message, $context); } @@ -51,7 +51,7 @@ public function alert($message, array $context = []) * @param string $message * @return void */ - public function critical($message, array $context = []) + public function critical($message, array $context = []): void { $this->log(LogLevel::CRITICAL, $message, $context); } @@ -60,7 +60,7 @@ public function critical($message, array $context = []) * @param string $message * @return void */ - public function error($message, array $context = []) + public function error($message, array $context = []): void { $this->log(LogLevel::ERROR, $message, $context); } @@ -69,7 +69,7 @@ public function error($message, array $context = []) * @param string $message * @return void */ - public function warning($message, array $context = []) + public function warning($message, array $context = []): void { $this->log(LogLevel::WARNING, $message, $context); } @@ -78,7 +78,7 @@ public function warning($message, array $context = []) * @param string $message * @return void */ - public function notice($message, array $context = []) + public function notice($message, array $context = []): void { $this->log(LogLevel::NOTICE, $message, $context); } @@ -87,7 +87,7 @@ public function notice($message, array $context = []) * @param string $message * @return void */ - public function info($message, array $context = []) + public function info($message, array $context = []): void { $this->log(LogLevel::INFO, $message, $context); } @@ -96,7 +96,7 @@ public function info($message, array $context = []) * @param string $message * @return void */ - public function debug($message, array $context = []) + public function debug($message, array $context = []): void { $this->log(LogLevel::DEBUG, $message, $context); } @@ -106,7 +106,7 @@ public function debug($message, array $context = []) * @param string $message * @return void */ - public function log($level, $message, array $context = []) + public function log($level, $message, array $context = []): void { foreach ($context as $key => $value) { $value = is_string($value) || is_array($value) ? $value : (string) $value; From b9a5398dacb6e6aa6d99b6f4018dbe3ce2c21821 Mon Sep 17 00:00:00 2001 From: Ben Yan Date: Tue, 15 Feb 2022 20:38:19 +0800 Subject: [PATCH 4/4] Fix code style Signed-off-by: Ben Yan --- src/Log/StdoutLogger.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Log/StdoutLogger.php b/src/Log/StdoutLogger.php index 37bff92e..cbd2d7e0 100644 --- a/src/Log/StdoutLogger.php +++ b/src/Log/StdoutLogger.php @@ -31,7 +31,6 @@ class StdoutLogger implements LoggerInterface { /** * @param string $message - * @return void */ public function emergency($message, array $context = []): void { @@ -40,7 +39,6 @@ public function emergency($message, array $context = []): void /** * @param string $message - * @return void */ public function alert($message, array $context = []): void { @@ -49,7 +47,6 @@ public function alert($message, array $context = []): void /** * @param string $message - * @return void */ public function critical($message, array $context = []): void { @@ -58,7 +55,6 @@ public function critical($message, array $context = []): void /** * @param string $message - * @return void */ public function error($message, array $context = []): void { @@ -67,7 +63,6 @@ public function error($message, array $context = []): void /** * @param string $message - * @return void */ public function warning($message, array $context = []): void { @@ -76,7 +71,6 @@ public function warning($message, array $context = []): void /** * @param string $message - * @return void */ public function notice($message, array $context = []): void { @@ -85,7 +79,6 @@ public function notice($message, array $context = []): void /** * @param string $message - * @return void */ public function info($message, array $context = []): void { @@ -94,7 +87,6 @@ public function info($message, array $context = []): void /** * @param string $message - * @return void */ public function debug($message, array $context = []): void { @@ -104,7 +96,6 @@ public function debug($message, array $context = []): void /** * @param mixed $level Generally a string from a LogLevel constant. * @param string $message - * @return void */ public function log($level, $message, array $context = []): void {