Skip to content

[Notifier] reject invalid option types in the Brevo transport #59365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ public function webUrl(string $url): static
/**
* @return $this
*/
public function type(string $type="transactional"): static
public function type(string $type = 'transactional'): static
{
$this->options['type'] = $type;

return $this;
}

/**
* @return $this
*/
public function tag(string $tag): static
{
$this->options['tag'] = $tag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
use Symfony\Component\Notifier\Exception\UnsupportedOptionsException;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Message\SmsMessage;
Expand Down Expand Up @@ -54,7 +55,13 @@ protected function doSend(MessageInterface $message): SentMessage
}

$sender = $message->getFrom() ?: $this->sender;
$options = $message->getOptions()?->toArray() ?? [];

if (($options = $message->getOptions()) && !$options instanceof BrevoOptions) {
throw new UnsupportedOptionsException(__CLASS__, BrevoOptions::class, $options);
}

$options = $options?->toArray() ?? [];

$body = [
'sender' => $sender,
'recipient' => $message->getPhone(),
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/Brevo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.3
---

* Add support for the `tag`, `type`, and `webUrl` options

6.4
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"require": {
"php": ">=8.2",
"symfony/http-client": "^6.4|^7.0",
"symfony/notifier": "^7.2"
"symfony/notifier": "^7.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the bump required?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception was introduced in #59234.

},
"require-dev": {
"symfony/event-dispatcher": "^5.4|^6.0|^7.0"
Expand Down