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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy