8000 bug #32302 [Mime] Remove @internal annotations for the serialize meth… · symfony/symfony@50dfcaa · GitHub
[go: up one dir, main page]

Skip to content

Commit 50dfcaa

Browse files
committed
bug #32302 [Mime] Remove @internal annotations for the serialize methods (francoispluchino)
This PR was merged into the 4.3 branch. Discussion ---------- [Mime] Remove @internal annotations for the serialize methods | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes (it's not really a bug) | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ Currently, when we extend the `Symfony\Component\Mime\Message` and `Symfony\Component\Mime\MessageRaw` classes of the Mime component, we get 2 deprecation messages: ``` The "Symfony\Component\Mime\Message::__serialize()" method is considered internal. It may change without further notice. You should not extend it from "Vendor\FooMessage". ``` and ``` The "Symfony\Component\Mime\Message::__unserialize()" method is considered internal. It may change without further notice. You should not extend it from "Vendor\FooMessage". ``` However, we need to add properties to the new class, and so, we need to extend `__serialize()` and `__unserialize()` methods in the same way as `Symfony\Bridge\Twig\Mime\TemplatedEmail`, to know, retrieve the serialization of the parent class: ```php public function __serialize(): array { return [$this->foo, $this->bar, $this->baz, parent::__serialize()]; } public function __unserialize(array $data): void { [$this->foo, $this->bar, $this->baz, $parentData] = $data; parent::__unserialize($parentData); } ``` But given that the third-party components use another namespace, we get the 2 deprecation messages, while the 2 methods must be inevitably used and extended. Of course, the methods `serialize()` and `unserialize()` are always marked by the `@internal` annotation and the `final` keyword. This PR so deletes the 2 deprecation messages that should not be displayed. Commits ------- 8544a35 Remove @internal annotations for the serilize methods
2 parents f5a0633 + 8544a35 commit 50dfcaa

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

src/Symfony/Component/Mime/Message.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,11 @@ private function generateMessageId(string $email): string
130130
return bin2hex(random_bytes(16)).strstr($email, '@');
131131
}
132132

133-
/**
134-
* @internal
135-
*/
136133
public function __serialize(): array
137134
{
138135
return [$this->headers, $this->body];
139136
}
140137

141-
/**
142-
* @internal
143-
*/
144138
public function __unserialize(array $data): void
145139
{
146140
[$this->headers, $this->body] = $data;

src/Symfony/Component/Mime/RawMessage.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,11 @@ final public function unserialize($serialized)
6969
$this->__unserialize(unserialize($serialized));
7070
}
7171

72-
/**
73-
* @internal
74-
*/
7572
public function __serialize(): array
7673
{
7774
return [$this->message];
7875
}
7976

80-
/**
81-
* @internal
82-
*/
8377
public function __unserialize(array $data): void
8478
{
8579
[$this->message] = $data;

0 commit comments

Comments
 (0)
0