From 51e3dc846fae2ee40083d5fa4962b470fd0152cf Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Thu, 5 Mar 2020 11:36:06 +0000
Subject: [PATCH] Issue #3117250 by alexpott, longwave: Update StringLoader and
 TestLoader for Twig 3 compatibility

---
 core/lib/Drupal/Core/Template/Loader/StringLoader.php | 10 +---------
 .../twig_loader_test/src/Loader/TestLoader.php        | 11 +----------
 .../Tests/Listeners/DeprecationListenerTrait.php      |  7 -------
 3 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/core/lib/Drupal/Core/Template/Loader/StringLoader.php b/core/lib/Drupal/Core/Template/Loader/StringLoader.php
index 3991a7268027..085348de3555 100644
--- a/core/lib/Drupal/Core/Template/Loader/StringLoader.php
+++ b/core/lib/Drupal/Core/Template/Loader/StringLoader.php
@@ -3,7 +3,6 @@
 namespace Drupal\Core\Template\Loader;
 
 use Twig\Loader\LoaderInterface;
-use Twig\Loader\SourceContextLoaderInterface;
 use Twig\Source;
 
 /**
@@ -24,7 +23,7 @@
  * @see \Drupal\Core\Render\Element\InlineTemplate
  * @see twig_render_template()
  */
-class StringLoader implements LoaderInterface, SourceContextLoaderInterface {
+class StringLoader implements LoaderInterface {
 
   /**
    * {@inheritdoc}
@@ -38,13 +37,6 @@ public function exists($name) {
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function getSource($name) {
-    return $name;
-  }
-
   /**
    * {@inheritdoc}
    */
diff --git a/core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php b/core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php
index 250950539f92..f7731d848340 100644
--- a/core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php
+++ b/core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php
@@ -2,15 +2,13 @@
 
 namespace Drupal\twig_loader_test\Loader;
 
-use Twig\Loader\ExistsLoaderInterface;
 use Twig\Loader\LoaderInterface;
-use Twig\Loader\SourceContextLoaderInterface;
 use Twig\Source;
 
 /**
  * A test Twig loader.
  */
-class TestLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface {
+class TestLoader implements LoaderInterface {
 
   /**
    * {@inheritdoc}
@@ -21,13 +19,6 @@ public function getSourceContext($name) {
     return new Source($value, $name);
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function getSource($name) {
-    return $this->getSourceContext($name)->getCode();
-  }
-
   /**
    * {@inheritdoc}
    */
diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
index 40eecbf2c5d4..86b67dcfd7c5 100644
--- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
+++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
@@ -147,13 +147,6 @@ public static function getSkippedDeprecations() {
       // This deprecation comes from behat/mink-browserkit-driver when updating
       // symfony/browser-kit to 4.3+.
       'The "Symfony\Component\BrowserKit\Response::getStatus()" method is deprecated since Symfony 4.3, use getStatusCode() instead.',
-      // The following deprecations are introduced in by the new
-      // DebugClassLoader in Symfony 4 we cannot immediately fix them without
-      // breaking backwards compatibility.
-      // @see https://www.drupal.org/project/drupal/issues/3030494
-      // @see https://www.drupal.org/project/drupal/issues/3030474
-      'The "Drupal\Core\Template\Loader\StringLoader" class implements "Twig\Loader\ExistsLoaderInterface" that is deprecated since 1.12 (to be removed in 3.0).',
-      'The "Drupal\Core\Template\Loader\StringLoader" class implements "Twig\Loader\SourceContextLoaderInterface" that is deprecated since 1.27 (to be removed in 3.0).',
       // The following Symfony deprecations are introduced in the Symfony 4
       // development cycle. They will need to be resolved prior to Symfony 5
       // compatibility.
-- 
GitLab