function StubCaster::castEnum
File
-
vendor/
symfony/ var-dumper/ Caster/ StubCaster.php, line 62
Class
- StubCaster
- Casts a caster's Stub.
Namespace
Symfony\Component\VarDumper\CasterCode
public static function castEnum(EnumStub $c, array $a, Stub $stub, bool $isNested) : array {
if ($isNested) {
$stub->class = $c->dumpKeys ? '' : null;
$stub->handle = 0;
$stub->value = null;
$stub->cut = $c->cut;
$stub->attr = $c->attr;
$a = [];
if ($c->value) {
foreach (array_keys($c->value) as $k) {
$keys[] = !isset($k[0]) || "\x00" !== $k[0] ? Caster::PREFIX_VIRTUAL . $k : $k;
}
// Preserve references with array_combine()
$a = array_combine($keys, $c->value);
}
}
return $a;
}