From 280209a3921e0dcb7b3edfefe9c509ff57aaa118 Mon Sep 17 00:00:00 2001
From: Chris Dart <571478+generalludd@users.noreply.github.com>
Date: Wed, 2 Apr 2025 11:07:16 -0500
Subject: [PATCH 1/4] Issue #3516912: add fallback for MemoryBackend

  This adds a fallback for the MemoryBackend::__construct() to allow
  instantiation without a time value in the signature.
---
 core/lib/Drupal/Core/Cache/MemoryBackend.php | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/core/lib/Drupal/Core/Cache/MemoryBackend.php b/core/lib/Drupal/Core/Cache/MemoryBackend.php
index dd0cea1372ad..ca033b3c0b2d 100644
--- a/core/lib/Drupal/Core/Cache/MemoryBackend.php
+++ b/core/lib/Drupal/Core/Cache/MemoryBackend.php
@@ -29,13 +29,25 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
    */
   protected $cache = [];
 
+ /**
+   * @var \Drupal\Component\Datetime\TimeInterface
+   */
+  protected TimeInterface $time;
+
   /**
    * Constructs a MemoryBackend object.
    *
-   * @param \Drupal\Component\Datetime\TimeInterface $time
+   * @param \Drupal\Component\Datetime\TimeInterface $time|NULL
    *   The time service.
    */
-  public function __construct(protected TimeInterface $time) {
+  public function __construct( TimeInterface $time = NULL) {
+    // Gracefully handle legacy calls to the constructor without a time service.
+    if ($time === NULL) {
+      $this->time = \Drupal::time();
+    }
+    else {
+      $this->time = $time;
+    }
   }
 
   /**
-- 
GitLab


From 0a9de7eda73c1712bf39fff50213a15e874d134c Mon Sep 17 00:00:00 2001
From: Chris Dart <571478+generalludd@users.noreply.github.com>
Date: Wed, 2 Apr 2025 11:09:39 -0500
Subject: [PATCH 2/4] Issue #3516912: Pantheon MemoryBackend failure.

 - Create a temporary patch to handle failed Pantheon builds with
   unidentified instantiation of MemoryBackend without a TimeInterface.
---
 core/lib/Drupal/Core/Cache/MemoryBackend.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/lib/Drupal/Core/Cache/MemoryBackend.php b/core/lib/Drupal/Core/Cache/MemoryBackend.php
index ca033b3c0b2d..1428283d11f6 100644
--- a/core/lib/Drupal/Core/Cache/MemoryBackend.php
+++ b/core/lib/Drupal/Core/Cache/MemoryBackend.php
@@ -29,7 +29,7 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
    */
   protected $cache = [];
 
- /**
+    /**
    * @var \Drupal\Component\Datetime\TimeInterface
    */
   protected TimeInterface $time;
-- 
GitLab


From 6a3923acab202a01e68b4e1251d8f91f71e3a8e0 Mon Sep 17 00:00:00 2001
From: Chris Dart <571478+generalludd@users.noreply.github.com>
Date: Wed, 2 Apr 2025 11:45:05 -0500
Subject: [PATCH 3/4] Issue #3516912: format code to meet Drupal standards

---
 core/lib/Drupal/Core/Cache/MemoryBackend.php | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/core/lib/Drupal/Core/Cache/MemoryBackend.php b/core/lib/Drupal/Core/Cache/MemoryBackend.php
index 1428283d11f6..de8fa25db660 100644
--- a/core/lib/Drupal/Core/Cache/MemoryBackend.php
+++ b/core/lib/Drupal/Core/Cache/MemoryBackend.php
@@ -29,7 +29,7 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
    */
   protected $cache = [];
 
-    /**
+  /**
    * @var \Drupal\Component\Datetime\TimeInterface
    */
   protected TimeInterface $time;
@@ -37,10 +37,10 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
   /**
    * Constructs a MemoryBackend object.
    *
-   * @param \Drupal\Component\Datetime\TimeInterface $time|NULL
+   * @param \Drupal\Component\Datetime\TimeInterface $time |NULL
    *   The time service.
    */
-  public function __construct( TimeInterface $time = NULL) {
+  public function __construct(TimeInterface $time = NULL) {
     // Gracefully handle legacy calls to the constructor without a time service.
     if ($time === NULL) {
       $this->time = \Drupal::time();
@@ -210,8 +210,7 @@ public function invalidateAll() {
   /**
    * {@inheritdoc}
    */
-  public function garbageCollection() {
-  }
+  public function garbageCollection() {}
 
   /**
    * {@inheritdoc}
-- 
GitLab


From 0b83b7d138138d644a68c58c18c03a9641b157a3 Mon Sep 17 00:00:00 2001
From: jquijano <64061-jonnathan.quijano@users.noreply.drupalcode.org>
Date: Sat, 12 Apr 2025 04:30:00 -0500
Subject: [PATCH 4/4] Issue #3769195 by chris dart, jquijano: Pantheon Builds
 fail with incorrect signature for MemoryBackend::_construct()

---
 core/lib/Drupal/Core/Cache/MemoryBackend.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/lib/Drupal/Core/Cache/MemoryBackend.php b/core/lib/Drupal/Core/Cache/MemoryBackend.php
index de8fa25db660..8bb7e757f675 100644
--- a/core/lib/Drupal/Core/Cache/MemoryBackend.php
+++ b/core/lib/Drupal/Core/Cache/MemoryBackend.php
@@ -37,10 +37,10 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
   /**
    * Constructs a MemoryBackend object.
    *
-   * @param \Drupal\Component\Datetime\TimeInterface $time |NULL
+   * @param \Drupal\Component\Datetime\TimeInterface|null $time
    *   The time service.
    */
-  public function __construct(TimeInterface $time = NULL) {
+  public function __construct(?TimeInterface $time = NULL) {
     // Gracefully handle legacy calls to the constructor without a time service.
     if ($time === NULL) {
       $this->time = \Drupal::time();
-- 
GitLab