Skip to content

Commit c3567f8

Browse files
committed
[Translator] deprecate getMessages in favor of getCatalogue.
1 parent 1973960 commit c3567f8

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/Symfony/Component/Translation/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
CHANGELOG
22
=========
33

4+
2.8.0
5+
-----
6+
* deprecated Translator::getMessages() in favor of the Translator::getCatalogue() method
7+
48
2.7.0
59
-----
610

src/Symfony/Component/Translation/Tests/TranslatorTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,10 @@ public function testTransChoiceFallbackWithNoTranslation()
499499
/**
500500
* @dataProvider dataProviderGetMessages
501501
*/
502-
public function testGetMessages($resources, $locale, $expected)
502+
public function testLegacyGetMessages($resources, $locale, $expected)
503503
{
504+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
505+
504506
$locales = array_keys($resources);
505507
$_locale = !is_null($locale) ? $locale : reset($locales);
506508
$locales = array_slice($locales, 0, array_search($_locale, $locales));

src/Symfony/Component/Translation/Translator.php

+2
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ protected function getLoaders()
292292
*/
293293
public function getMessages($locale = null)
294294
{
295+
trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the getCatalogue() method instead.', E_USER_DEPRECATED);
296+
295297
$catalogues = array();
296298
$catalogues[] = $catalogue = $this->getCatalogue($locale);
297299
while ($catalogue = $catalogue->getFallbackCatalogue()) {

0 commit comments

Comments
 (0)