-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logger interface incompatible with Psr\Log\LoggerTrait:log() (968) #1518
Comments
Hi @areklam, thanks for the issue & PR. |
Hi, using Sword (Bedrock-like for Symfony) this error makes it impossible to use this plugin as well. |
For what it's worth to anyone dealing with this issue in 2025. Here is the simple 1 line fix (hack) I have been using for the last several versions: Replace
with
In /woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58. Might it be possible to include this change in an upcoming release ? |
We appreciate your suggestions and patience. Due to union types, adopting this change in the core plugin would require raising the minimum PHP version to 8.0. Since our minimum PHP requirement was only recently increased to 7.4, we’re not yet able to introduce union types in the plugin. However, we created a fix for an upcoming major update (date TBD) using scoped |
Describe the Bug
The WooCommerce logging interface module attempt to use
Psr\Log\LoggerTrait
with invalid interface. The classesWooCommerceLogger
andNullLogger
both implementPsr\Log\LoggerInterface
and declare the log function without a function return type.The solution is to include the return type for the log functions which is supposed to be void.
To Reproduce
Screenshots
Expected Behavior
Plugin activated, no errors.
Actual Behavior
Error message
Fatal error: Declaration of WooCommerce\WooCommerce\Logging\Logger\WooCommerceLogger::log($level, $message, array $context = []) must be compatible with Psr\Log\LoggerTrait::log($level, Stringable|string $message, array $context = []): void
Environment
The text was updated successfully, but these errors were encountered: