Skip to content

Commit

Permalink
Added __unserialize method to all reflections with __serialize to fix…
Browse files Browse the repository at this point in the history
… Symfony cache issue
  • Loading branch information
vudaltsov committed Sep 30, 2023
1 parent 8faf375 commit 51650a0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ClassReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,13 @@ public function __serialize(): array
return $vars;
}

public function __unserialize(array $data): void
{
foreach ($data as $name => $value) {
$this->{$name} = $value;
}
}

public function __clone()
{
if ((debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['class'] ?? null) !== self::class) {
Expand Down
7 changes: 7 additions & 0 deletions src/MethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,13 @@ public function __serialize(): array
return $data;
}

public function __unserialize(array $data): void
{
foreach ($data as $name => $value) {
$this->{$name} = $value;
}
}

public function __clone()
{
if ((debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['class'] ?? null) !== self::class) {
Expand Down
7 changes: 7 additions & 0 deletions src/ParameterReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ public function __serialize(): array
return $data;
}

public function __unserialize(array $data): void
{
foreach ($data as $name => $value) {
$this->{$name} = $value;
}
}

/**
* @return ?positive-int
*/
Expand Down
7 changes: 7 additions & 0 deletions src/PropertyReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ public function __serialize(): array
return $data;
}

public function __unserialize(array $data): void
{
foreach ($data as $name => $value) {
$this->{$name} = $value;
}
}

public function __clone()
{
if ((debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['class'] ?? null) !== self::class) {
Expand Down

0 comments on commit 51650a0

Please sign in to comment.