Skip to content

Commit 84633d9

Browse files
committed
refactor: rename expeditor to sender
1 parent 8bb582e commit 84633d9

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

packages/mailer/src/EmailToSymfonyEmailMapper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
use Symfony\Component\Mime\Address as SymfonyAddress;
88
use Symfony\Component\Mime\Email as SymfonyEmail;
9-
use Tempest\Mail\Exceptions\ExpeditorWasMissing;
109
use Tempest\Mail\Exceptions\RecipientWasMissing;
10+
use Tempest\Mail\Exceptions\SenderWasMissing;
1111
use Tempest\Mapper\Mapper;
1212
use Tempest\Support\Arr;
1313
use Tempest\View\View;
@@ -43,10 +43,10 @@ public function map(mixed $from, mixed $to): SymfonyEmail
4343

4444
if ($email->envelope->from) {
4545
$symfonyEmail->from(...$this->convertAddresses($email->envelope->from));
46-
} elseif ($this->mailerConfig->defaultExpeditor) {
47-
$symfonyEmail->from($this->mailerConfig->defaultExpeditor);
46+
} elseif ($this->mailerConfig->defaultSender) {
47+
$symfonyEmail->from($this->mailerConfig->defaultSender);
4848
} else {
49-
throw new ExpeditorWasMissing();
49+
throw new SenderWasMissing();
5050
}
5151

5252
if ($email->envelope->to) {

packages/mailer/src/Exceptions/ExpeditorWasMissing.php

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Tempest\Mail\Exceptions;
4+
5+
use Exception;
6+
7+
final class SenderWasMissing extends Exception implements MailerException
8+
{
9+
public function __construct()
10+
{
11+
parent::__construct('No sender address provided.');
12+
}
13+
}

packages/mailer/src/MailerConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface MailerConfig
1919
/**
2020
* The default address from which emails will be sent.
2121
*/
22-
public null|string|Address $defaultExpeditor {
22+
public null|string|Address $defaultSender {
2323
get;
2424
}
2525

packages/mailer/src/Testing/SentTestingEmail.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function assertFrom(string|array $addresses): self
8787
return $this->assertAddressListContains(
8888
haystack: $this->symfonyEmail->getFrom(),
8989
needles: $addresses,
90-
message: 'Failed asserting that the email was sent from [%s]. The expeditors are [%s].',
90+
message: 'Failed asserting that the email was sent from [%s]. The senders are [%s].',
9191
);
9292
}
9393

@@ -99,7 +99,7 @@ public function assertNotFrom(string|array $addresses): self
9999
return $this->assertAddressListDoesNotContain(
100100
haystack: $this->symfonyEmail->getFrom(),
101101
needles: $addresses,
102-
message: 'Failed asserting that the email was not sent from [%s]. The expeditors are [%s].',
102+
message: 'Failed asserting that the email was not sent from [%s]. The senders are [%s].',
103103
);
104104
}
105105

packages/mailer/src/Transports/Postmark/PostmarkConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242
/**
4343
* Address from which emails are sent by default.
4444
*/
45-
public null|string|Address $defaultExpeditor = null,
45+
public null|string|Address $defaultSender = null,
4646

4747
/**
4848
* Whether to use Postmark's API or SMTP server.

packages/mailer/src/Transports/Ses/SesMailerConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(
5454
/**
5555
* Address from which emails are sent by default.
5656
*/
57-
public null|string|Address $defaultExpeditor = null,
57+
public null|string|Address $defaultSender = null,
5858

5959
/**
6060
* Whether to use Amazon SES's API or async HTTP transport.

packages/mailer/src/Transports/Smtp/SmtpMailerConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(
4646
/**
4747
* The default address from which emails will be sent.
4848
*/
49-
public null|string|Address $defaultExpeditor = null,
49+
public null|string|Address $defaultSender = null,
5050

5151
/**
5252
* Whether to use TLS for this connection.

tests/Integration/Mailer/MailerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use Tempest\Mail\Content;
66
use Tempest\Mail\Envelope;
7-
use Tempest\Mail\Exceptions\ExpeditorWasMissing;
87
use Tempest\Mail\Exceptions\RecipientWasMissing;
8+
use Tempest\Mail\Exceptions\SenderWasMissing;
99
use Tempest\Mail\GenericEmail;
1010
use Tempest\Mail\Mailer;
1111
use Tests\Tempest\Integration\FrameworkIntegrationTestCase;
@@ -18,7 +18,7 @@ final class MailerTest extends FrameworkIntegrationTestCase
1818

1919
public function test_sending_mail_requires_from(): void
2020
{
21-
$this->expectException(ExpeditorWasMissing::class);
21+
$this->expectException(SenderWasMissing::class);
2222

2323
$this->mailer->send(new GenericEmail(
2424
envelope: new Envelope(

0 commit comments

Comments
 (0)