diff --git a/Tests/TranslatorBagTest.php b/Tests/TranslatorBagTest.php index a202bc65..58b8fa02 100644 --- a/Tests/TranslatorBagTest.php +++ b/Tests/TranslatorBagTest.php @@ -82,8 +82,8 @@ public function testIntersect() $this->assertEquals([ 'en' => [ - 'domain1' => ['bar' => 'bar'], - 'domain2' => ['qux' => 'qux'], + 'domain1' => ['foo' => 'foo'], + 'domain2' => ['baz' => 'baz'], ], ], $this->getAllMessagesFromTranslatorBag($bagResult)); } diff --git a/TranslatorBag.php b/TranslatorBag.php index ffd109f1..9be3458c 100644 --- a/TranslatorBag.php +++ b/TranslatorBag.php @@ -94,7 +94,10 @@ public function intersect(TranslatorBagInterface $intersectBag): self $obsoleteCatalogue = new MessageCatalogue($locale); foreach ($operation->getDomains() as $domain) { - $obsoleteCatalogue->add($operation->getObsoleteMessages($domain), $domain); + $obsoleteCatalogue->add( + array_diff($operation->getMessages($domain), $operation->getNewMessages($domain)), + $domain + ); } $diff->addCatalogue($obsoleteCatalogue);