X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/0ac4d5b99450481d171b0f9ed2411a17c1dc873b..7c1cf77e5008890f143f00e0b7a931ef7d7a77fb:/Entity/User.php

diff --git a/Entity/User.php b/Entity/User.php
index 61be105..7d274f9 100644
--- a/Entity/User.php
+++ b/Entity/User.php
@@ -22,7 +22,7 @@ use Rapsys\UserBundle\Entity\Group;
 /**
  * User
  */
-class User implements UserInterface, PasswordAuthenticatedUserInterface, \Serializable {
+class User implements UserInterface, PasswordAuthenticatedUserInterface {
 	/**
 	 * @var integer
 	 */
@@ -83,7 +83,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, \Serial
 	 *
 	 * @param ?string $mail The user mail
 	 */
-	public function __construct(?string $mail) {
+	public function __construct(?string $mail = null) {
 		//With mail
 		if ($mail !== null && !empty($mail)) {
 			$this->mail = $mail;
@@ -435,8 +435,8 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, \Serial
 	/**
 	 * {@inheritdoc}
 	 */
-	public function serialize(): string {
-		return serialize([
+	public function __serialize(): array {
+		return [
 			$this->id,
 			$this->mail,
 			$this->forename,
@@ -446,13 +446,13 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, \Serial
 			$this->disabled,
 			$this->created,
 			$this->updated
-		]);
+		];
 	}
 
 	/**
 	 * {@inheritdoc}
 	 */
-	public function unserialize($serialized) {
+	public function __unserialize(array $data): void {
 		list(
 			$this->id,
 			$this->mail,
@@ -463,7 +463,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, \Serial
 			$this->disabled,
 			$this->created,
 			$this->updated
-		) = unserialize($serialized);
+		) = $data;
 	}
 
 	/**