Skip to content

Commit ef9988b

Browse files
Replace __sleep/wakeup() by __(un)serialize() for throwing and internal usages
1 parent 890bc0b commit ef9988b

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

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
}

Tests/Kernel/ConcreteMicroKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ public function getLogDir(): string
6363
return $this->cacheDir;
6464
}
6565

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

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

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
}

0 commit comments

Comments
 (0)