Skip to content

Commit d1347f0

Browse files
[VarExporter] Fix lazy-proxying readonly classes on PHP 8.3
1 parent 39fd2a6 commit d1347f0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Caster/SymfonyCaster.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,21 @@ public static function castLazyObjectState($state, array $a, Stub $stub, bool $i
7676

7777
$stub->cut += \count($a) - 1;
7878

79-
return ['status' => new ConstStub(match ($a['status']) {
79+
$instance = $a['realInstance'] ?? null;
80+
81+
$a = ['status' => new ConstStub(match ($a['status']) {
8082
LazyObjectState::STATUS_INITIALIZED_FULL => 'INITIALIZED_FULL',
8183
LazyObjectState::STATUS_INITIALIZED_PARTIAL => 'INITIALIZED_PARTIAL',
8284
LazyObjectState::STATUS_UNINITIALIZED_FULL => 'UNINITIALIZED_FULL',
8385
LazyObjectState::STATUS_UNINITIALIZED_PARTIAL => 'UNINITIALIZED_PARTIAL',
8486
}, $a['status'])];
87+
88+
if ($instance) {
89+
$a['realInstance'] = $instance;
90+
--$stub->cut;
91+
}
92+
93+
return $a;
8594
}
8695

8796
public static function castUuid(Uuid $uuid, array $a, Stub $stub, bool $isNested)

0 commit comments

Comments
 (0)