10000 feature #15869 [Translation][file dump] remove deprecated format meth… · symfony/symfony@a56f907 · GitHub
[go: up one dir, main page]

Skip to content

Commit a56f907

Browse files
committed
feature #15869 [Translation][file dump] remove deprecated format method. (aitboudad)
This PR was merged into the 3.0-dev branch. Discussion ---------- [Translation][file dump] remove deprecated format method. | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT Commits ------- 6ee96fb [Translation][file dump] remove deprecated format method.
2 parents 111bdc5 + 6ee96fb commit a56f907

13 files changed

+29
-123
lines changed

UPGRADE-3.0.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,33 @@ UPGRADE FROM 2.x to 3.0
728728
}
729729
```
730730

731+
* The method `FileDumper::format()` was removed. You should use
732+
`FileDumper::formatCatalogue()` instead.
733+
734+
Before:
735+
736+
```php
737+
class CustomDumper extends FileDumper
738+
{
739+
protected function format(MessageCatalogue $messages, $domain)
740+
{
741+
...
742+
}
743+
}
744+
```
745+
746+
After:
747+
748+
```php
749+
class CustomDumper extends FileDumper
750+
{
751+
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
752+
{
753+
...
754+
}
755+
}
756+
```
757+
731758
### Twig Bridge
732759

733760
* The `twig:lint` command has been deprecated since Symfony 2.7 and will be

src/Symfony/Component/Translation/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
3.0.0
55
-----
66

7+
* removed `FileDumper::format()` method.
78
* Changed the visibility of the locale property in `Translator` from protected to private.
89

910
2.8.0

src/Symfony/Component/Translation/Dumper/CsvFileDumper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ class CsvFileDumper extends FileDumper
2323
private $delimiter = ';';
2424
private $enclosure = '"';
2525

26-
/**
27-
* {@inheritdoc}
28-
*/
29-
public function format(MessageCatalogue $messages, $domain = 'messages')
30-
{
31-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
32-
33-
return $this->formatCatalogue($messages, $domain);
34-
}
35-
3626
/**
3727
* {@inheritdoc}
3828
*/

src/Symfony/Component/Translation/Dumper/FileDumper.php

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -89,35 +89,13 @@ public function dump(MessageCatalogue $messages, $options = array())
8989
/**
9090
* Transforms a domain of a message catalogue to its string representation.
9191
*
92-
* Override this function in child class if $options is used for message formatting.
93-
*
9492
* @param MessageCatalogue $messages
9593
* @param string $domain
9694
* @param array $options
9795
*
9896
* @return string representation
9997
*/
100-
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
101-
{
102-
@trigger_error('The '.__METHOD__.' method will replace the format method in 3.0. You should overwrite it instead of overwriting format instead.', E_USER_DEPRECATED);
103-
104-
return $this->format($messages, $domain);
105-
}
106-
107-
/**
108-
* Transforms a domain of a message catalogue to its string representation.
109-
*
110-
* @param MessageCatalogue $messages
111-
* @param string $domain
112-
*
113-
* @return string representation
114-
*
115-
* @deprecated since version 2.8, to be removed in 3.0. Overwrite formatCatalogue() instead.
116-
*/
117-
protected function format(MessageCatalogue $messages, $domain)
118-
{
119-
throw new \LogicException('The "FileDumper::format" method needs to be overwritten, you should implement either "format" or "formatCatalogue".');
120-
}
98+
abstract public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array());
12199

122100
/**
123101
* Gets the file extension of the dumper.

src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ class IcuResFileDumper extends FileDumper
2525
*/
2626
protected $relativePathTemplate = '%domain%/%locale%.%extension%';
2727

28-
/**
29-
* {@inheritdoc}
30-
*/
31-
public function format(MessageCatalogue $messages, $domain = 'messages')
32-
{
33-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
34-
35-
return $this->formatCatalogue($messages, $domain);
36-
}
37-
3828
/**
3929
* {@inheritdoc}
4030
*/

src/Symfony/Component/Translation/Dumper/IniFileDumper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020
*/
2121
class IniFileDumper extends FileDumper
2222
{
23-
/**
24-
* {@inheritdoc}
25-
*/
26-
public function format(MessageCatalogue $messages, $domain = 'messages')
27-
{
28-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
29-
30-
return $this->formatCatalogue($messages, $domain);
31-
}
32-
3323
/**
3424
* {@inheritdoc}
3525
*/

src/Symfony/Component/Translation/Dumper/JsonFileDumper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020
*/
2121
class JsonFileDumper extends FileDumper
2222
{
23-
/**
24-
* {@inheritdoc}
25-
*/
26-
public function format(MessageCatalogue $messages, $domain = 'messages')
27-
{
28-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
29-
30-
return $this->formatCatalogue($messages, $domain);
31-
}
32-
3323
/**
3424
* {@inheritdoc}
3525
*/

src/Symfony/Component/Translation/Dumper/MoFileDumper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@
2121
*/
2222
class MoFileDumper extends FileDumper
2323
{
24-
/**
25-
* {@inheritdoc}
26-
*/
27-
public function format(MessageCatalogue $messages, $domain = 'messages')
28-
{
29-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
30-
31-
return $this->formatCatalogue($messages, $domain);
32-
}
33-
3424
/**
3525
* {@inheritdoc}
3626
*/

src/Symfony/Component/Translation/Dumper/PhpFileDumper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020
*/
2121
class PhpFileDumper extends FileDumper
2222
{
23-
/**
24-
* {@inheritdoc}
25-
*/
26-
protected function format(MessageCatalogue $messages, $domain)
27-
{
28-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
29-
30-
return $this->formatCatalogue($messages, $domain);
31-
}
32-
3323
/**
3424
* {@inheritdoc}
3525
*/

src/Symfony/Component/Translation/Dumper/PoFileDumper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020
*/
2121
class PoFileDumper extends FileDumper
2222
{
23-
/**
24-
* {@inheritdoc}
25-
*/
26-
public function format(MessageCatalogue $messages, $domain = 'messages')
27-
{
28-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
29-
30-
return $this->formatCatalogue($messages, $domain);
31-
}
32-
3323
/**
3424
* {@inheritdoc}
3525
*/

src/Symfony/Component/Translation/Dumper/QtFileDumper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020
*/
2121
class QtFileDumper extends FileDumper
2222
{
23-
/**
24-
* {@inheritdoc}
25-
*/
26-
public function format(MessageCatalogue $messages, $domain)
27-
{
28-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
29-
30-
return $this->formatCatalogue($messages, $domain);
31-
}
32-
3323
/**
3424
* {@inheritdoc}
3525
*/

src/Symfony/Component/Translation/Dumper/XliffFileDumper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,6 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
4646
throw new \InvalidArgumentException(sprintf('No support implemented for dumping XLIFF version "%s".', $xliffVersion));
4747
}
4848

49-
/**
50-
* {@inheritdoc}
51-
*/
52-
protected function format(MessageCatalogue $messages, $domain)
53-
{
54-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
55-
56-
return $this->formatCatalogue($messages, $domain);
57-
}
58-
5949
/**
6050
* {@inheritdoc}
6151
*/

src/Symfony/Component/Translation/Dumper/YamlFileDumper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
4444
return Yaml::dump($data);
4545
}
4646

47-
/**
48-
* {@inheritdoc}
49-
*/
50-
protected function format(MessageCatalogue $messages, $domain)
51-
{
52-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
53-
54-
return $this->formatCatalogue($messages, $domain);
55-
}
56-
5747
/**
5848
* {@inheritdoc}
5949
*/

0 commit comments

Comments
 (0)
0