8000 [String] implement __sleep()/__wakeup() on strings · symfony/symfony@416e40d · GitHub
[go: up one dir, main page]

Skip to content

Commit 416e40d

Browse files
[String] implement __sleep()/__wakeup() on strings
1 parent 98694d8 commit 416e40d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Symfony/Component/String/AbstractString.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,11 @@ public function wordwrap(int $width = 75, string $break = "\n", bool $cut = fals
692692
return $str;
693693
}
694694

695+
public function __sleep(): array
696+
{
697+
return ['string'];
698+
}
699+
695700
public function __clone()
696701
{
697702
$this->ignoreCase = false;

src/Symfony/Component/String/UnicodeString.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,11 @@ public function startsWith($prefix): bool
347347
return $prefix === grapheme_extract($this->string, \strlen($prefix), GRAPHEME_EXTR_MAXBYTES);
348348
}
349349

350+
public function __wakeup()
351+
{
352+
normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
353+
}
354+
350355
public function __clone()
351356
{
352357
if (null === $this->ignoreCase) {

0 commit comments

Comments
 (0)
0