Skip to content

Error in Magento 2.4.7-p2 with Bridge SDK - Issue with NullLogger Interface Implementation #3

@MedSaidBenAli

Description

@MedSaidBenAli

We have encountered an issue with Magento 2.4.7-p2 where the NullLogger class in the bridge-sdk package does not implement the LoggerInterface methods with the correct type hints, causing compatibility issues.

Steps to Reproduce:

  1. Install Magento 2.4.7-p2 with the Bridge SDK (202ecommerce/bridge-sdk).
  2. Attempt to log any message using the NullLogger class.
  3. Observe the error due to incorrect method signatures.

Expected Behavior:
The NullLogger class should correctly implement the LoggerInterface methods with the appropriate type hints for PHP 8.x compatibility.

Actual Behavior:
The NullLogger class currently uses method signatures without proper type hints, causing runtime errors.

Proposed Solution:
The following patch fixes the issue by adding type hints to the method signatures:

Index: vendor/202ecommerce/bridge-sdk/src/Logger/NullLogger.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/vendor/202ecommerce/bridge-sdk/src/Logger/NullLogger.php b/vendor/202ecommerce/bridge-sdk/src/Logger/NullLogger.php
--- a/vendor/202ecommerce/bridge-sdk/src/Logger/NullLogger.php	(revision eaace34e5b25a1e8dcc2596c1f62852164b06512)
+++ b/vendor/202ecommerce/bridge-sdk/src/Logger/NullLogger.php	(date 1724426858356)
@@ -19,39 +19,39 @@
 
 class NullLogger implements LoggerInterface
 {
-    public function emergency($message, array $context = [])
+    public function emergency(string|\Stringable $message, array $context = []): void
     {
     }
 
-    public function alert($message, array $context = [])
+    public function alert(string|\Stringable $message, array $context = []): void
     {
     }
 
-    public function critical($message, array $context = [])
+    public function critical(string|\Stringable $message, array $context = []): void
     {
     }
 
-    public function error($message, array $context = [])
+    public function error(string|\Stringable $message, array $context = []): void
     {
     }
 
-    public function warning($message, array $context = [])
+    public function warning(string|\Stringable $message, array $context = []): void
     {
     }
 
-    public function notice($message, array $context = [])
+    public function notice(string|\Stringable $message, array $context = []): void
     {
     }
 
-    public function info($message, array $context = [])
+    public function info(string|\Stringable $message, array $context = []): void
     {
     }
 
-    public function debug($message, array $context = [])
+    public function debug(string|\Stringable $message, array $context = []): void
     {
     }
 
-    public function log($level, $message, array $context = [])
+    public function log($level, string|\Stringable $message, array $context = []): void
     {
     }
 }

PR: BridgeAPI-Io/SDK-Bridge#1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions