Commit cadc4132 authored by catch's avatar catch
Browse files

Revert "Issue #3269141 by longwave, sharayurajput, andypost: Alias deprecated...

Revert "Issue #3269141 by longwave, sharayurajput, andypost: Alias deprecated Drupal\Core\StringTranslation\TranslationWrapper to TranslatableMarkup"

This reverts commit c728e353.
parent c728e353
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -60,11 +60,6 @@
 */
define('DRUPAL_ROOT', dirname(__DIR__, 2));

/**
 * Keep backward compatibility for sites with references to TranslationWrapper.
 */
class_alias(TranslatableMarkup::class, '\Drupal\Core\StringTranslation\TranslationWrapper', TRUE);

/**
 * Translates a string to the current language or to a given language.
 *
+23 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\Core\StringTranslation;

/**
 * Provides translatable string class.
 *
 * @deprecated in drupal:8.0.0 and is removed from drupal:10.0.0.
 *   Use the \Drupal\Core\StringTranslation\TranslatableMarkup class instead.
 *
 * @see https://www.drupal.org/node/2571255
 */
class TranslationWrapper extends TranslatableMarkup {

  /**
   * {@inheritdoc}
   */
  public function __construct($string, array $arguments = [], array $options = [], TranslationInterface $string_translation = NULL) {
    @trigger_error(__CLASS__ . ' is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use the \Drupal\Core\StringTranslation\TranslatableMarkup class instead. See https://www.drupal.org/node/2571255', E_USER_DEPRECATED);
    parent::__construct($string, $arguments, $options, $string_translation);
  }

}
+4 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
use Drupal\Tests\UnitTestCase;

/**
 * Tests the TranslationWrapper backward compatibility layer.
 * Tests the TranslationWrapper class.
 *
 * @coversDefaultClass \Drupal\Core\StringTranslation\TranslationWrapper
 * @group StringTranslation
@@ -16,9 +16,11 @@ class TranslationWrapperTest extends UnitTestCase {

  /**
   * @covers ::__construct
   * @group legacy
   */
  public function testTranslationWrapper() {
    $object = new TranslationWrapper('Backward compatibility');
    $this->expectDeprecation('Drupal\Core\StringTranslation\TranslationWrapper is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use the \Drupal\Core\StringTranslation\TranslatableMarkup class instead. See https://www.drupal.org/node/2571255');
    $object = new TranslationWrapper('Deprecated');
    $this->assertInstanceOf(TranslatableMarkup::class, $object);
  }