Skip to content

Commit 66c853d

Browse files
Replace __sleep/wakeup() by __(un)serialize() for throwing and internal usages
1 parent 80f7288 commit 66c853d

File tree

5 files changed

+8
-17
lines changed

5 files changed

+8
-17
lines changed

Adapter/TagAwareAdapter.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,12 @@ public function reset()
294294
$this->tags instanceof ResettableInterface && $this->tags->reset();
295295
}
296296

297-
public function __sleep(): array
297+
public function __serialize(): array
298298
{
299299
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
300300
}
301301

302-
/**
303-
* @return void
304-
*/
305-
public function __wakeup()
302+
public function __unserialize(array $data): void
306303
{
307304
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
308305
}

Tests/Adapter/AdapterTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ public function testErrorsDontInvalidate()
373373

374374
class NotUnserializable
375375
{
376-
public function __wakeup()
376+
public function __unserialize(array $data): void
377377
{
378378
throw new \Exception(__CLASS__);
379379
}

Tests/Psr16CacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ protected function isPruned(CacheInterface $cache, string $name): bool
176176

177177
class NotUnserializable
178178
{
179-
public function __wakeup()
179+
public function __unserialize(array $data): void
180180
{
181181
throw new \Exception(__CLASS__);
182182
}

Traits/AbstractAdapterTrait.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,12 @@ public function reset(): void
276276
$this->ids = [];
277277
}
278278

279-
public function __sleep(): array
279+
public function __serialize(): array
280280
{
281281
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
282282
}
283283

284-
/**
285-
* @return void
286-
*/
287-
public function __wakeup()
284+
public function __unserialize(array $data): void
288285
{
289286
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
290287
}

Traits/FilesystemCommonTrait.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,12 @@ private function scanHashDir(string $directory): \Generator
172172
}
173173
}
174174

175-
public function __sleep(): array
175+
public function __serialize(): array
176176
{
177177
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
178178
}
179179

180-
/**
181-
* @return void
182-
*/
183-
public function __wakeup()
180+
public function __unserialize(array $data): void
184181
{
185182
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
186183
}

0 commit comments

Comments
 (0)