Skip to content

Commit 61a7e8c

Browse files
committed
Fixes #162: __sleep() & __wakeup() is deprecated in PHP 8.5
1 parent 7159809 commit 61a7e8c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Enum.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ final public function __sleep()
9696
throw new LogicException('Serialization is not supported by default in this pseudo-enum implementation');
9797
}
9898

99+
/**
100+
* @throws LogicException Serialization is not supported by default in this pseudo-enum implementation
101+
*
102+
* @return array<string, mixed>
103+
* @psalm-return never-return
104+
*/
105+
public function __serialize(): array
106+
{
107+
throw new LogicException('Serialization is not supported by default in this pseudo-enum implementation');
108+
}
109+
99110
/**
100111
* @throws LogicException Serialization is not supported by default in this pseudo-enum implementation
101112
*
@@ -106,6 +117,17 @@ final public function __wakeup()
106117
throw new LogicException('Serialization is not supported by default in this pseudo-enum implementation');
107118
}
108119

120+
/**
121+
* @throws LogicException Serialization is not supported by default in this pseudo-enum implementation
122+
*
123+
* @param array<string, mixed> $data
124+
* @psalm-return never-return
125+
*/
126+
public function __unserialize(array $data): void
127+
{
128+
throw new LogicException('Serialization is not supported by default in this pseudo-enum implementation');
129+
}
130+
109131
/**
110132
* Get the value of the enumerator
111133
*

0 commit comments

Comments
 (0)