Unverified Commit b43d1290 authored by larowlan's avatar larowlan
Browse files

Issue #2791907 by ddrozdik, Chi: Improve TranslatableMarkup and FormattableMarkup classes

parent 05b9f0a9
...@@ -61,6 +61,13 @@ ...@@ -61,6 +61,13 @@
*/ */
class FormattableMarkup implements MarkupInterface, \Countable { class FormattableMarkup implements MarkupInterface, \Countable {
/**
* The string containing placeholders.
*
* @var string
*/
protected $string;
/** /**
* The arguments to replace placeholders with. * The arguments to replace placeholders with.
* *
......
...@@ -23,13 +23,6 @@ class TranslatableMarkup extends FormattableMarkup { ...@@ -23,13 +23,6 @@ class TranslatableMarkup extends FormattableMarkup {
use ToStringTrait; use ToStringTrait;
/**
* The string to be translated.
*
* @var string
*/
protected $string;
/** /**
* The translated markup without placeholder replacements. * The translated markup without placeholder replacements.
* *
...@@ -139,8 +132,7 @@ public function __construct($string, array $arguments = [], array $options = [], ...@@ -139,8 +132,7 @@ public function __construct($string, array $arguments = [], array $options = [],
$message = $string instanceof TranslatableMarkup ? '$string ("' . $string->getUntranslatedString() . '") must be a string.' : '$string ("' . (string) $string . '") must be a string.'; $message = $string instanceof TranslatableMarkup ? '$string ("' . $string->getUntranslatedString() . '") must be a string.' : '$string ("' . (string) $string . '") must be a string.';
throw new \InvalidArgumentException($message); throw new \InvalidArgumentException($message);
} }
$this->string = $string; parent::__construct($string, $arguments);
$this->arguments = $arguments;
$this->options = $options; $this->options = $options;
$this->stringTranslation = $string_translation; $this->stringTranslation = $string_translation;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment