Skip to content

Commit 0a2fff9

Browse files
[7.0] Cleanup legacy code paths
1 parent b7c1c23 commit 0a2fff9

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

RawMessage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ public function toString(): string
4343
public function toIterable(): iterable
4444
{
4545
if ($this->isGeneratorClosed ?? false) {
46-
trigger_deprecation('symfony/mime', '6.4', 'Sending an email with a closed generator is deprecated and will throw in 7.0.');
47-
// throw new LogicException('Unable to send the email as its generator is already closed.');
46+
throw new LogicException('Unable to send the email as its generator is already closed.');
4847
}
4948

5049
if (\is_string($this->message)) {

Tests/RawMessageTest.php

+3-8
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212
namespace Symfony\Component\Mime\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
15+
use Symfony\Component\Mime\Exception\LogicException;
1616
use Symfony\Component\Mime\RawMessage;
1717

1818
class RawMessageTest extends TestCase
1919
{
20-
use ExpectDeprecationTrait;
21-
2220
/**
2321
* @dataProvider provideMessages
2422
*/
@@ -65,18 +63,15 @@ public function testToIterable(mixed $messageParameter, bool $supportReuse)
6563

6664
/**
6765
* @dataProvider provideMessages
68-
*
69-
* @group legacy
7066
*/
7167
public function testToIterableLegacy(mixed $messageParameter, bool $supportReuse)
7268
{
7369
$message = new RawMessage($messageParameter);
7470
$this->assertEquals('some string', implode('', iterator_to_array($message->toIterable())));
7571

7672
if (!$supportReuse) {
77-
// in 7.0, the test with a generator will throw an exception
78-
$this->expectDeprecation('Since symfony/mime 6.4: Sending an email with a closed generator is deprecated and will throw in 7.0.');
79-
$this->assertEquals('some string', implode('', iterator_to_array($message->toIterable())));
73+
$this->expectException(LogicException::class);
74+
iterator_to_array($message->toIterable());
8075
}
8176
}
8277

0 commit comments

Comments
 (0)