Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Mime] remove deprecated methods in Mime Component #50869

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
Jul 4, 2023
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
6 changes: 6 additions & 0 deletions UPGRADE-7.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ Messenger

* Add parameter `$isSameDatabase` to `DoctrineTransport::configureSchema()`

Mime
----

* Remove `Email::attachPart()` method, use `Email::addPart()` instead
* Parameter `$body` is now required (at least null) in `Message::setBody()`

PropertyAccess
--------------

Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/Mime/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
=========

7.0
---

* Remove `Email::attachPart()`, use `Email::addPart()` instead
* Argument `$body` is now required (at least null) in `Message::setBody()`

6.3
---

Expand Down
12 changes: 0 additions & 12 deletions src/Symfony/Component/Mime/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,18 +356,6 @@ public function embedFromPath(string $path, string $name = null, string $content
return $this->addPart((new DataPart(new File($path), $name, $contentType))->asInline());
}

/**
* @return $this
*
* @deprecated since Symfony 6.2, use addPart() instead
*/
public function attachPart(DataPart $part): static
{
@trigger_deprecation('symfony/mime', '6.2', 'The "%s()" method is deprecated, use "addPart()" instead.', __METHOD__);

return $this->addPart($part);
}

/**
* @return $this
*/
Expand Down
5 changes: 1 addition & 4 deletions src/Symfony/Component/Mime/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ public function __clone()
/**
* @return $this
*/
public function setBody(AbstractPart $body = null): static
public function setBody(?AbstractPart $body): static
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/mime', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
$this->body = $body;

return $this;
Expand Down