Skip to content

Commit d7488da

Browse files
Replace __sleep/wakeup() by __(un)serialize() to accomodate for PHP 8.5
1 parent fa2356a commit d7488da

File tree

55 files changed

+516
-310
lines changed

Some content is hidden

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

55 files changed

+516
-310
lines changed

.github/expected-missing-return-types.diff

Lines changed: 33 additions & 178 deletions
Large diffs are not rendered by default.

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,12 @@ private function sendToElasticsearch(array $records): void
149149
$this->wait(false);
150150
}
151151

152-
public function __sleep(): array
152+
public function __serialize(): array
153153
{
154154
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
155155
}
156156

157-
/**
158-
* @return void
159-
*/
160-
public function __wakeup()
157+
public function __unserialize(array $data): void
161158
{
162159
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
163160
}

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
@@ -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
}

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 & 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
}

src/Symfony/Component/Cache/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
}

src/Symfony/Component/Cache/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
}

src/Symfony/Component/Cache/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
}

0 commit comments

Comments
 (0)