diff --git a/core/lib/Drupal/Core/StringTranslation/TranslationManager.php b/core/lib/Drupal/Core/StringTranslation/TranslationManager.php index 038ac52..4e61b2a 100644 --- a/core/lib/Drupal/Core/StringTranslation/TranslationManager.php +++ b/core/lib/Drupal/Core/StringTranslation/TranslationManager.php @@ -166,8 +166,7 @@ public function renderTranslatedString(TranslationWrapper $translated_string) { $value = $this->doTranslate($translated_string->getUntranslatedString(), $translated_string->getOptions()); // Handle any replacements. - $args = $translated_string->getArguments(); - if (!empty($args)) { + if ($args = $translated_string->getArguments()) { $value = $this->placeholderFormat($value, $args); } return $value; diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php index 6041e74..047d316 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php @@ -77,11 +77,11 @@ public function testFormatPlural($count, $singular, $plural, array $args = array public function testTranslatePlaceholder($string, array $args = array(), $expected_string, $returns_translation_wrapper) { $actual = $this->translationManager->translate($string, $args); if ($returns_translation_wrapper) { - $this->assertInstanceOf('Drupal\Component\Utility\SafeStringInterface', $actual); + $this->assertInstanceOf(SafeStringInterface::class, $actual); $actual->setStringTranslation($this->translationManager); } else { - $this->assertTrue(is_string($actual)); + $this->assertInternalType('string', $actual); } $this->assertEquals($expected_string, $actual); }