minor #14356 [Translation] LoggingTranslator simplifications (xabbuh)
This PR was merged into the 2.6 branch.
Discussion
----------
[Translation] LoggingTranslator simplifications
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
5d7a4f9
[Translation] LoggingTranslator simplifications
This commit is contained in:
commit
bb4d45e777
@ -19,7 +19,7 @@ use Psr\Log\LoggerInterface;
|
||||
class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface
|
||||
{
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
* @var TranslatorInterface|TranslatorBagInterface
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
@ -29,13 +29,13 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* @param Translator $translator
|
||||
* @param LoggerInterface $logger
|
||||
* @param TranslatorInterface $translator The translator must implement TranslatorBagInterface
|
||||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function __construct($translator, LoggerInterface $logger)
|
||||
public function __construct(TranslatorInterface $translator, LoggerInterface $logger)
|
||||
{
|
||||
if (!($translator instanceof TranslatorInterface && $translator instanceof TranslatorBagInterface)) {
|
||||
throw new \InvalidArgumentException(sprintf('The Translator "%s" must implements TranslatorInterface and TranslatorBagInterface.', get_class($translator)));
|
||||
if (!$translator instanceof TranslatorBagInterface) {
|
||||
throw new \InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator)));
|
||||
}
|
||||
|
||||
$this->translator = $translator;
|
||||
|
Reference in New Issue
Block a user