diff --git a/composer.lock b/composer.lock index 7646a7bad54cccc303eccd35a296d31d9de86b35..29ef27e5be3708ac39e347f7616f2daff2f306b7 100644 --- a/composer.lock +++ b/composer.lock @@ -441,7 +441,7 @@ "dist": { "type": "path", "url": "core", - "reference": "78d71b79ee40fcc2305472ed336bddcb03aacafc" + "reference": "dc9d28de148cebd49d2c7cf3650fd836ed430a77" }, "require": { "asm89/stack-cors": "^2.0.2", @@ -466,7 +466,7 @@ "masterminds/html5": "^2.7", "pear/archive_tar": "^1.4.14", "php": ">=8.1.0", - "psr/log": "^2.0", + "psr/log": "^3.0", "symfony/console": "^6.1", "symfony/dependency-injection": "^6.1", "symfony/event-dispatcher": "^6.1", @@ -1756,16 +1756,16 @@ }, { "name": "psr/log", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", - "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "shasum": "" }, "require": { @@ -1774,7 +1774,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { @@ -1800,9 +1800,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/2.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.0" }, - "time": "2021-07-14T16:41:46+00:00" + "time": "2021-07-14T16:46:02+00:00" }, { "name": "ralouphie/getallheaders", diff --git a/composer/Metapackage/CoreRecommended/composer.json b/composer/Metapackage/CoreRecommended/composer.json index b834c72c69cc3f47f622d54f77d292280c37fc32..507be0410db9aac49e43862b28d37f3fb9e59c7e 100644 --- a/composer/Metapackage/CoreRecommended/composer.json +++ b/composer/Metapackage/CoreRecommended/composer.json @@ -27,7 +27,7 @@ "psr/http-client": "1.0.1", "psr/http-factory": "1.0.1", "psr/http-message": "1.0.1", - "psr/log": "2.0.0", + "psr/log": "3.0.0", "ralouphie/getallheaders": "3.0.3", "symfony/console": "v6.1.1", "symfony/dependency-injection": "v6.1.0", diff --git a/core/composer.json b/core/composer.json index 35557a180660a3664e4c6cf56af842ef525b28ed..2baa1b95f1d6e67880f04742f1757a94c0c13ef9 100644 --- a/core/composer.json +++ b/core/composer.json @@ -41,7 +41,7 @@ "composer/semver": "^3.3", "asm89/stack-cors": "^2.0.2", "pear/archive_tar": "^1.4.14", - "psr/log": "^2.0" + "psr/log": "^3.0" }, "conflict": { "drush/drush": "<8.1.10" diff --git a/core/lib/Drupal/Core/Logger/LoggerChannel.php b/core/lib/Drupal/Core/Logger/LoggerChannel.php index c0722387f54c6946a0dfa955bd539a4bac1f6782..08cc46f7b844f59f9005158e3d0a36ca174f8a0d 100644 --- a/core/lib/Drupal/Core/Logger/LoggerChannel.php +++ b/core/lib/Drupal/Core/Logger/LoggerChannel.php @@ -91,7 +91,7 @@ public function __construct($channel) { /** * {@inheritdoc} */ - public function log($level, $message, array $context = []) { + public function log($level, string|\Stringable $message, array $context = []): void { if ($this->callDepth == self::MAX_CALL_DEPTH) { return; } diff --git a/core/lib/Drupal/Core/Logger/RfcLoggerTrait.php b/core/lib/Drupal/Core/Logger/RfcLoggerTrait.php index 0152efe2c7bf28d5b81f43e47c3a2b84505b4612..def2e7ffc3f4432d595197701cf335cbf698f2bf 100644 --- a/core/lib/Drupal/Core/Logger/RfcLoggerTrait.php +++ b/core/lib/Drupal/Core/Logger/RfcLoggerTrait.php @@ -17,62 +17,62 @@ trait RfcLoggerTrait { /** * {@inheritdoc} */ - public function emergency($message, array $context = []) { + public function emergency(string|\Stringable $message, array $context = []): void { $this->log(RfcLogLevel::EMERGENCY, $message, $context); } /** * {@inheritdoc} */ - public function alert($message, array $context = []) { + public function alert(string|\Stringable $message, array $context = []): void { $this->log(RfcLogLevel::ALERT, $message, $context); } /** * {@inheritdoc} */ - public function critical($message, array $context = []) { + public function critical(string|\Stringable $message, array $context = []): void { $this->log(RfcLogLevel::CRITICAL, $message, $context); } /** * {@inheritdoc} */ - public function error($message, array $context = []) { + public function error(string|\Stringable $message, array $context = []): void { $this->log(RfcLogLevel::ERROR, $message, $context); } /** * {@inheritdoc} */ - public function warning($message, array $context = []) { + public function warning(string|\Stringable $message, array $context = []): void { $this->log(RfcLogLevel::WARNING, $message, $context); } /** * {@inheritdoc} */ - public function notice($message, array $context = []) { + public function notice(string|\Stringable $message, array $context = []): void { $this->log(RfcLogLevel::NOTICE, $message, $context); } /** * {@inheritdoc} */ - public function info($message, array $context = []) { + public function info(string|\Stringable $message, array $context = []): void { $this->log(RfcLogLevel::INFO, $message, $context); } /** * {@inheritdoc} */ - public function debug($message, array $context = []) { + public function debug(string|\Stringable $message, array $context = []): void { $this->log(RfcLogLevel::DEBUG, $message, $context); } /** * {@inheritdoc} */ - abstract public function log($level, $message, array $context = []); + abstract public function log($level, string|\Stringable $message, array $context = []): void; } diff --git a/core/modules/dblog/src/Logger/DbLog.php b/core/modules/dblog/src/Logger/DbLog.php index 4207a5c9db09fb62634a4d188628f37bd242b57b..c2219fd0291cf0da7fe3e201158666aadd804f54 100644 --- a/core/modules/dblog/src/Logger/DbLog.php +++ b/core/modules/dblog/src/Logger/DbLog.php @@ -52,7 +52,7 @@ public function __construct(Connection $connection, LogMessageParserInterface $p /** * {@inheritdoc} */ - public function log($level, $message, array $context = []) { + public function log($level, string|\Stringable $message, array $context = []): void { // Remove backtrace and exception since they may contain an unserializable variable. unset($context['backtrace'], $context['exception']); diff --git a/core/modules/syslog/src/Logger/SysLog.php b/core/modules/syslog/src/Logger/SysLog.php index 7526841a19275cea5c90f769c293d7064d373936..5e1b4eded3cc216c29752eadcaca71a7569d36f0 100644 --- a/core/modules/syslog/src/Logger/SysLog.php +++ b/core/modules/syslog/src/Logger/SysLog.php @@ -60,7 +60,7 @@ protected function openConnection() { /** * {@inheritdoc} */ - public function log($level, $message, array $context = []) { + public function log($level, string|\Stringable $message, array $context = []): void { global $base_url; $format = $this->config->get('format'); diff --git a/core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php b/core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php index 3f18bb9437a178532464144a33e2c48dbc75f602..12ace44f6dc69b4f2fc68fcf7bee71918f103c92 100644 --- a/core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php +++ b/core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php @@ -16,7 +16,7 @@ class TestLog implements LoggerInterface { /** * {@inheritdoc} */ - public function log($level, $message, array $context = []) { + public function log($level, string|\Stringable $message, array $context = []): void { $trigger = [ '%type' => 'Exception', '@message' => 'Deforestation', diff --git a/core/modules/update/tests/src/Unit/UpdateFetcherTest.php b/core/modules/update/tests/src/Unit/UpdateFetcherTest.php index c530848a2dfc101637058b8907974a7074e14a8b..2150e49a6748132aa027dfe13e7406ea22d42453 100644 --- a/core/modules/update/tests/src/Unit/UpdateFetcherTest.php +++ b/core/modules/update/tests/src/Unit/UpdateFetcherTest.php @@ -243,7 +243,7 @@ public function testUpdateFetcherHttpFallback() { /** * {@inheritdoc} */ - public function log($level, $message, array $context = []) { + public function log($level, string|\Stringable $message, array $context = []): void { $this->logMessages[] = $context['@message']; } diff --git a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php index 45c7bc42322e999814804225b4554c498cde4c8f..fc4727c999527801b3eb16a17cc82520c288fe74 100644 --- a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php +++ b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php @@ -192,7 +192,7 @@ public function __construct(LoggerChannel $channel) { $this->channel = $channel; } - public function log($level, $message, array $context = []) { + public function log($level, string|\Stringable $message, array $context = []): void { $this->channel->log(rand(0, 7), $message, $context); }