Skip to content

Commit f910c37

Browse files
authored
Implement new interfaces from symfony/translation-contracts (#29)
1 parent 45c7266 commit f910c37

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
cat <<< $(jq --arg version $VERSION '.require |= with_entries(if ((.key|test("^symfony/monolog")|not) and (.key|test("^symfony/"))) then .value=$version else . end)' < composer.json) > composer.json
3+
cat <<< $(jq --arg version $VERSION '.require |= with_entries(if ((.key|test("^symfony/translation-contracts")|not) and (.key|test("^symfony/"))) then .value=$version else . end)' < composer.json) > composer.json

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@
2828
"symfony/config": "^3.4.31|^4.0",
2929
"symfony/dependency-injection": "^3.4.31|^4.0",
3030
"symfony/finder": "^3.4.31|^4.0",
31+
"symfony/framework-bundle": "^4.4",
3132
"symfony/http-kernel": "^3.4.31|^4.0",
32-
"symfony/translation": "^3.4.31|^4.0",
33+
"symfony/translation": "^4.2",
34+
"symfony/translation-contracts": "^1.0.2|^2.0|^3.0",
3335
"twig/twig": "^1.42|^2.0|^3.0"
3436
},
3537
"require-dev": {
3638
"phpunit/phpunit": "^8.5 | ^9.0",
37-
"symfony/framework-bundle": "^3.4.31|^4.0",
3839
"symfony/monolog-bundle": "^3.4.31|^4.0",
3940
"symfony/phpunit-bridge": "> 5.0",
4041
"symfony/twig-bundle": "^3.4.31|^4.0",

src/Translator/FormatterDecorator.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,35 @@
22

33
namespace Webfactory\IcuTranslationBundle\Translator;
44

5-
use Symfony\Component\Translation\TranslatorInterface;
5+
use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface;
6+
use Symfony\Contracts\Translation\TranslatorInterface;
67
use Webfactory\IcuTranslationBundle\Translator\Formatting\FormatterInterface;
78

89
/**
910
* Decorates a Symfony translator and adds support for message formatting.
1011
*/
11-
class FormatterDecorator implements TranslatorInterface
12+
class FormatterDecorator implements LegacyTranslatorInterface, TranslatorInterface
1213
{
1314
/**
1415
* The inner translator.
1516
*
1617
* @var \Symfony\Component\Translation\TranslatorInterface
1718
*/
18-
protected $translator = null;
19+
protected $translator;
1920

2021
/**
2122
* The formatter that is used to apply message transformations.
2223
*
2324
* @var \Webfactory\IcuTranslationBundle\Translator\Formatting\IntlFormatter
2425
*/
25-
protected $formatter = null;
26+
protected $formatter;
2627

2728
/**
2829
* Creates a decorator for the provided translator.
2930
*
3031
* @param \Webfactory\IcuTranslationBundle\Translator\Formatting\FormatterInterface the formatter that is used
3132
*/
32-
public function __construct(TranslatorInterface $translator, FormatterInterface $formatter)
33+
public function __construct(LegacyTranslatorInterface $translator, FormatterInterface $formatter)
3334
{
3435
$this->translator = $translator;
3536
$this->formatter = $formatter;

0 commit comments

Comments
 (0)