Skip to content

Commit 6740cdc

Browse files
Replace __sleep/wakeup() by __(un)serialize() for throwing and internal usages
1 parent b8e9dce commit 6740cdc

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

Chunk/ErrorChunk.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,12 @@ public function didThrow(?bool $didThrow = null): bool
9393
return $this->didThrow;
9494
}
9595

96-
public function __sleep(): array
96+
public function __serialize(): array
9797
{
9898
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
9999
}
100100

101-
/**
102-
* @return void
103-
*/
104-
public function __wakeup()
101+
public function __unserialize(array $data): void
105102
{
106103
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
107104
}

HttplugClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ public function createUri($uri = ''): UriInterface
250250
throw new \LogicException(\sprintf('You cannot use "%s()" as no PSR-17 factories have been found. Try running "composer require php-http/discovery psr/http-factory-implementation:*".', __METHOD__));
251251
}
252252

253-
public function __sleep(): array
253+
public function __serialize(): array
254254
{
255255
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
256256
}
257257

258-
public function __wakeup(): void
258+
public function __unserialize(array $data): void
259259
{
260260
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
261261
}

Response/AmpResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ public function getInfo(?string $type = null): mixed
140140
return null !== $type ? $this->info[$type] ?? null : $this->info;
141141
}
142142

143-
public function __sleep(): array
143+
public function __serialize(): array
144144
{
145145
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
146146
}
147147

148-
public function __wakeup(): void
148+
public function __unserialize(array $data): void
149149
{
150150
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
151151
}

Response/CommonResponseTrait.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,12 @@ public function toStream(bool $throw = true)
119119
return $stream;
120120
}
121121

122-
public function __sleep(): array
122+
public function __serialize(): array
123123
{
124124
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
125125
}
126126

127-
/**
128-
* @return void
129-
*/
130-
public function __wakeup()
127+
public function __unserialize(array $data): void
131128
{
132129
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
133130
}

Response/TraceableResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ public function __construct(HttpClientInterface $client, ResponseInterface $resp
4444
$this->event = $event;
4545
}
4646

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

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

0 commit comments

Comments
 (0)