Normalizes an AbstractEnum instance to its string value.
Description
This ensures comparisons work correctly even after deserialization (e.g. Redis/Memcached object cache), where AbstractEnum singletons are reconstructed as separate instances.
Parameters
$valuemixedrequired- The value to normalize.
Source
private static function normalizeValue($value)
{
if ($value instanceof AbstractEnum) {
return $value->value;
}
return $value;
}
Changelog
| Version | Description |
|---|---|
| 1.2.1 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.