fix:修复BUG/升级1.1.6版本
This commit is contained in:
42
vendor/dasprid/enum/src/EnumMap.php
vendored
42
vendor/dasprid/enum/src/EnumMap.php
vendored
@@ -88,6 +88,31 @@ final class EnumMap implements Serializable, IteratorAggregate
|
||||
$this->values = array_fill(0, count($this->keyUniverse), null);
|
||||
}
|
||||
|
||||
public function __serialize(): array
|
||||
{
|
||||
$values = [];
|
||||
|
||||
foreach ($this->values as $ordinal => $value) {
|
||||
if (null === $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$values[$ordinal] = $this->unmaskNull($value);
|
||||
}
|
||||
|
||||
return [
|
||||
'keyType' => $this->keyType,
|
||||
'valueType' => $this->valueType,
|
||||
'allowNullValues' => $this->allowNullValues,
|
||||
'values' => $values,
|
||||
];
|
||||
}
|
||||
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
$this->unserialize(serialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the map types match the supplied ones.
|
||||
*
|
||||
@@ -261,22 +286,7 @@ final class EnumMap implements Serializable, IteratorAggregate
|
||||
|
||||
public function serialize() : string
|
||||
{
|
||||
$values = [];
|
||||
|
||||
foreach ($this->values as $ordinal => $value) {
|
||||
if (null === $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$values[$ordinal] = $this->unmaskNull($value);
|
||||
}
|
||||
|
||||
return serialize([
|
||||
'keyType' => $this->keyType,
|
||||
'valueType' => $this->valueType,
|
||||
'allowNullValues' => $this->allowNullValues,
|
||||
'values' => $values,
|
||||
]);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
public function unserialize($serialized) : void
|
||||
|
||||
Reference in New Issue
Block a user