Skip to content

Commit c8b4a3f

Browse files
Replace __sleep/wakeup() by __(un)serialize() for throwing and internal usages
1 parent 85ca8b5 commit c8b4a3f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Key.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,16 @@ public function isExpired(): bool
9090
return null !== $this->expiringTime && $this->expiringTime <= microtime(true);
9191
}
9292

93-
public function __sleep(): array
93+
public function __serialize(): array
9494
{
9595
if (!$this->serializable) {
9696
throw new UnserializableKeyException('The key cannot be serialized.');
9797
}
9898

99-
return ['resource', 'expiringTime', 'state'];
99+
return [
100+
'resource' => $this->resource,
101+
'expiringTime' => $this->expiringTime,
102+
'state' => $this->state,
103+
];
100104
}
101105
}

Lock.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public function __construct(
4242
) {
4343
}
4444

45-
public function __sleep(): array
45+
public function __serialize(): array
4646
{
4747
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
4848
}
4949

50-
public function __wakeup(): void
50+
public function __unserialize(array $data): void
5151
{
5252
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
5353
}

0 commit comments

Comments
 (0)