From 7d769cf87da4f619fa01f7c3ae01852eb1410c9a Mon Sep 17 00:00:00 2001 From: Vlad Tudorie Date: Thu, 5 Feb 2026 10:57:14 +0200 Subject: [PATCH] Fix PSR-3 v3 compatibility for Logger class The log() method signature must match Psr\Log\AbstractLogger::log() which in psr/log 3.x requires: - \Stringable|string type hint for $message parameter - void return type This fixes fatal errors when running with PHP 8.x and psr/log ^3.0: Fatal error: Declaration of SatisPress\Logger::log($level, $message, array $context = []) must be compatible with Psr\Log\AbstractLogger::log($level, Stringable|string $message, array $context = []): void --- src/Logger.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Logger.php b/src/Logger.php index c73ca91..7a7b0e5 100644 --- a/src/Logger.php +++ b/src/Logger.php @@ -66,11 +66,12 @@ public function __construct( string $minimum_level ) { * * @since 0.4.0 * - * @param string $level PSR log level. - * @param string $message Log message. - * @param array $context Additional data. + * @param mixed $level PSR log level. + * @param \Stringable|string $message Log message. + * @param array $context Additional data. + * @return void */ - public function log( $level, $message, array $context = [] ) { + public function log( $level, \Stringable|string $message, array $context = [] ): void { if ( ! $this->handle_level( $level ) ) { return; } @@ -80,7 +81,7 @@ public function log( $level, $message, array $context = [] ) { sprintf( 'SATISPRESS.%s: %s', strtoupper( $level ), - $this->format( $message, $context ) + $this->format( (string) $message, $context ) ) ); }