From 0a2fff95c1a10df97f571d67e76c7ae0f0d4f535 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 18 Oct 2023 14:57:55 +0200 Subject: [PATCH] [7.0] Cleanup legacy code paths --- RawMessage.php | 3 +-- Tests/RawMessageTest.php | 11 +++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/RawMessage.php b/RawMessage.php index 53638e7..5ee1f61 100644 --- a/RawMessage.php +++ b/RawMessage.php @@ -43,8 +43,7 @@ public function toString(): string public function toIterable(): iterable { if ($this->isGeneratorClosed ?? false) { - trigger_deprecation('symfony/mime', '6.4', 'Sending an email with a closed generator is deprecated and will throw in 7.0.'); - // throw new LogicException('Unable to send the email as its generator is already closed.'); + throw new LogicException('Unable to send the email as its generator is already closed.'); } if (\is_string($this->message)) { diff --git a/Tests/RawMessageTest.php b/Tests/RawMessageTest.php index fa802f4..da77e3e 100644 --- a/Tests/RawMessageTest.php +++ b/Tests/RawMessageTest.php @@ -12,13 +12,11 @@ namespace Symfony\Component\Mime\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; +use Symfony\Component\Mime\Exception\LogicException; use Symfony\Component\Mime\RawMessage; class RawMessageTest extends TestCase { - use ExpectDeprecationTrait; - /** * @dataProvider provideMessages */ @@ -65,8 +63,6 @@ public function testToIterable(mixed $messageParameter, bool $supportReuse) /** * @dataProvider provideMessages - * - * @group legacy */ public function testToIterableLegacy(mixed $messageParameter, bool $supportReuse) { @@ -74,9 +70,8 @@ public function testToIterableLegacy(mixed $messageParameter, bool $supportReuse $this->assertEquals('some string', implode('', iterator_to_array($message->toIterable()))); if (!$supportReuse) { - // in 7.0, the test with a generator will throw an exception - $this->expectDeprecation('Since symfony/mime 6.4: Sending an email with a closed generator is deprecated and will throw in 7.0.'); - $this->assertEquals('some string', implode('', iterator_to_array($message->toIterable()))); + $this->expectException(LogicException::class); + iterator_to_array($message->toIterable()); } }