From 88bfcf0ad9e38c679db1e9a10ae6c10e39968462 Mon Sep 17 00:00:00 2001 From: Marc Bennewitz Date: Sun, 14 Sep 2025 11:50:55 +0200 Subject: [PATCH] Fixes #162: __sleep() & __wakeup() is deprecated in PHP 8.5 --- src/Enum.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Enum.php b/src/Enum.php index d602d8b..e9ef6ff 100644 --- a/src/Enum.php +++ b/src/Enum.php @@ -96,6 +96,16 @@ final public function __sleep() throw new LogicException('Serialization is not supported by default in this pseudo-enum implementation'); } + /** + * @throws LogicException Serialization is not supported by default in this pseudo-enum implementation + * + * @return array + */ + public function __serialize(): array + { + throw new LogicException('Serialization is not supported by default in this pseudo-enum implementation'); + } + /** * @throws LogicException Serialization is not supported by default in this pseudo-enum implementation * @@ -106,6 +116,16 @@ final public function __wakeup() throw new LogicException('Serialization is not supported by default in this pseudo-enum implementation'); } + /** + * @throws LogicException Serialization is not supported by default in this pseudo-enum implementation + * + * @param array $data + */ + public function __unserialize(array $data): void + { + throw new LogicException('Serialization is not supported by default in this pseudo-enum implementation'); + } + /** * Get the value of the enumerator *