Skip to content

Commit f68e3f5

Browse files
Merge branch '6.4' into 7.3
* 6.4: Replace __sleep/wakeup() by __(un)serialize() for throwing and internal usages
2 parents 741d418 + 92a6bd1 commit f68e3f5

File tree

56 files changed

+334
-264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+334
-264
lines changed

src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ private function sendToElasticsearch(array $records): void
138138
$this->wait(false);
139139
}
140140

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

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

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ public function __construct(array $mockedNamespaces = [])
9393
}
9494
}
9595

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

101-
public function __wakeup()
101+
public function __unserialize(array $data): void
102102
{
103103
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
104104
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,16 @@ protected function build(ContainerBuilder $container): void
8989
$container->registerExtension(new TestDumpExtension());
9090
}
9191

92-
public function __sleep(): array
92+
public function __serialize(): array
9393
{
94-
return ['varDir', 'testCase', 'rootConfig', 'environment', 'debug'];
94+
return [$this->varDir, $this->testCase, $this->rootConfig, $this->environment, $this->debug];
9595
}
9696

97-
public function __wakeup(): void
97+
public function __unserialize(array $data): void
9898
{
99-
foreach ($this as $k => $v) {
99+
[$this->varDir, $this->testCase, $this->rootConfig, $this->environment, $this->debug] = $data;
100+
101+
foreach ($this as $v) {
100102
if (\is_object($v)) {
101103
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
102104
}

src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ public function getLogDir(): string
5555
return $this->cacheDir;
5656
}
5757

58-
public function __sleep(): array
58+
public function __serialize(): array
5959
{
6060
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
6161
}
6262

63-
public function __wakeup(): void
63+
public function __unserialize(array $data): void
6464
{
6565
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
6666
}

src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ public function getProjectDir(): string
6464
return \dirname((new \ReflectionObject($this))->getFileName(), 2);
6565
}
6666

67-
public function __sleep(): array
67+
public function __serialize(): array
6868
{
6969
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
7070
}
7171

72-
public function __wakeup(): void
72+
public function __unserialize(array $data): void
7373
{
7474
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
7575
}

src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,12 @@ public function reset(): void
309309
$this->tags instanceof ResettableInterface && $this->tags->reset();
310310
}
311311

312-
public function __sleep(): array
312+
public function __serialize(): array
313313
{
314314
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
315315
}
316316

317-
public function __wakeup(): void
317+
public function __unserialize(array $data): void
318318
{
319319
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
320320
}

src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ public function testNamespaces()
399399

400400
class NotUnserializable
401401
{
402-
public function __wakeup(): void
402+
public function __unserialize(array $data): void
403403
{
404404
throw new \Exception(__CLASS__);
405405
}

src/Symfony/Component/Cache/Tests/Psr16CacheTest.php

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

175175
class NotUnserializable
176176
{
177-
public function __wakeup(): void
177+
public function __unserialize(array $data): void
178178
{
179179
throw new \Exception(__CLASS__);
180180
}

src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,12 @@ public function reset(): void
288288
$this->ids = [];
289289
}
290290

291-
public function __sleep(): array
291+
public function __serialize(): array
292292
{
293293
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
294294
}
295295

296-
public function __wakeup(): void
296+
public function __unserialize(array $data): void
297297
{
298298
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
299299
}

src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ private function scanHashDir(string $directory): \Generator
168168
}
169169
}
170170

171-
public function __sleep(): array
171+
public function __serialize(): array
172172
{
173173
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
174174
}
175175

176-
public function __wakeup(): void
176+
public function __unserialize(array $data): void
177177
{
178178
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
179179
}

0 commit comments

Comments
 (0)