Skip to content

Commit 4814309

Browse files
[3.0] Various deprecation removal
1 parent 898d1d5 commit 4814309

File tree

2 files changed

+0
-137
lines changed

2 files changed

+0
-137
lines changed

Tests/TranslatorTest.php

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -495,121 +495,6 @@ public function testTransChoiceFallbackWithNoTranslation()
495495
// unchanged if it can't be found
496496
$this->assertEquals('some_message2', $translator->transChoice('some_message2', 10, array('%count%' => 10)));
497497
}
498-
499-
/**
500-
* @group legacy
501-
* @dataProvider dataProviderGetMessages
502-
*/
503-
public function testLegacyGetMessages($resources, $locale, $expected)
504-
{
505-
$locales = array_keys($resources);
506-
$_locale = null !== $locale ? $locale : reset($locales);
507-
$locales = array_slice($locales, 0, array_search($_locale, $locales));
508-
509-
$translator = new Translator($_locale, new MessageSelector());
510-
$translator->setFallbackLocales(array_reverse($locales));
511-
$translator->addLoader('array', new ArrayLoader());
512-
foreach ($resources as $_locale => $domainMessages) {
513-
foreach ($domainMessages as $domain => $messages) {
514-
$translator->addResource('array', $messages, $_locale, $domain);
515-
}
516-
}
517-
$result = $translator->getMessages($locale);
518-
519-
$this->assertEquals($expected, $result);
520-
}
521-
522-
public function dataProviderGetMessages()
523-
{
524-
$resources = array(
525-
'en' => array(
526-
'jsmessages' => array(
527-
'foo' => 'foo (EN)',
528-
'bar' => 'bar (EN)',
529-
),
530-
'messages' => array(
531-
'foo' => 'foo messages (EN)',
532-
),
533-
'validators' => array(
534-
'int' => 'integer (EN)',
535-
),
536-
),
537-
'pt-PT' => array(
538-
'messages' => array(
539-
'foo' => 'foo messages (PT)',
540-
),
541-
'validators' => array(
542-
'str' => 'integer (PT)',
543-
),
544-
),
545-
'pt_BR' => array(
546-
'validators' => array(
547-
'int' => 'integer (BR)',
548-
),
549-
),
550-
);
551-
552-
return array(
553-
array($resources, null,
554-
array(
555-
'jsmessages' => array(
556-
'foo' => 'foo (EN)',
557-
'bar' => 'bar (EN)',
558-
),
559-
'messages' => array(
560-
'foo' => 'foo messages (EN)',
561-
),
562-
'validators' => array(
563-
'int' => 'integer (EN)',
564-
),
565-
),
566-
),
567-
array($resources, 'en',
568-
array(
569-
'jsmessages' => array(
570-
'foo' => 'foo (EN)',
571-
'bar' => 'bar (EN)',
572-
),
573-
'messages' => array(
574-
'foo' => 'foo messages (EN)',
575-
),
576-
'validators' => array(
577-
'int' => 'integer (EN)',
578-
),
579-
),
580-
),
581-
array($resources, 'pt-PT',
582-
array(
583-
'jsmessages' => array(
584-
'foo' => 'foo (EN)',
585-
'bar' => 'bar (EN)',
586-
),
587-
'messages' => array(
588-
'foo' => 'foo messages (PT)',
589-
),
590-
'validators' => array(
591-
'int' => 'integer (EN)',
592-
'str' => 'integer (PT)',
593-
),
594-
),
595-
),
596-
array($resources, 'pt_BR',
597-
array(
598-
'jsmessages' => array(
599-
'foo' => 'foo (EN)',
600-
'bar' => 'bar (EN)',
601-
),
602-
'messages' => array(
603-
'foo' => 'foo messages (PT)',
604-
),
605-
'validators' => array(
606-
'int' => 'integer (BR)',
607-
'str' => 'integer (PT)',
608-
),
609-
),
610-
),
611-
);
612-
}
613498
}
614499

615500
class StringClass

Translator.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -265,28 +265,6 @@ protected function getLoaders()
265265
return $this->loaders;
266266
}
267267

268-
/**
269-
* Collects all messages for the given locale.
270-
*
271-
* @param string|null $locale Locale of translations, by default is current locale
272-
*
273-
* @return array[array] indexed by catalog
274-
*
275-
* @deprecated since version 2.8, to be removed in 3.0. Use TranslatorBagInterface::getCatalogue() method instead.
276-
*/
277-
public function getMessages($locale = null)
278-
{
279-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use TranslatorBagInterface::getCatalogue() method instead.', E_USER_DEPRECATED);
280-
281-
$catalogue = $this->getCatalogue($locale);
282-
$messages = $catalogue->all();
283-
while ($catalogue = $catalogue->getFallbackCatalogue()) {
284-
$messages = array_replace_recursive($catalogue->all(), $messages);
285-
}
286-
287-
return $messages;
288-
}
289-
290268
/**
291269
* @param string $locale
292270
*/

0 commit comments

Comments
 (0)