SupportedOption::normalizeValue( mixed $value ): mixed

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

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.

Return

mixed The normalized value.

Source

private static function normalizeValue($value)
{
    if ($value instanceof AbstractEnum) {
        return $value->value;
    }
    return $value;
}

Changelog

VersionDescription
1.2.1Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.