src/Valkyrja/Enum/Enum.php
public static function isValid($value): bool
    {
        if (\is_array($value) || \is_object($value)) {
            return false;
        }

        // Get the valid values to compare with
        $validValues = static::validValues();

        // If the value isset in the valid values array and the value matches
        // the value to check
        // ?? Why is this here ??
        // As is known by all isset is faster than in_array. We want to
        // capitalize on that with some enums by making the const VALUES
        // array a key value pair of the value itself so that we've
        // essentially got value => value for each item in the const VALUES
        // array. This way we can take advantage of the quickness of isset over
        // in_array. However, because not all enums may do this we need to
        // ensure if the value isset as the key in the array that it also
        // matches as the value of that item in the array, otherwise we'll
        // get false positives where its a normal array of 0 => value, 1 =>
        // value and we check for 0 being a valid value where it may very
        // well not be valid at all.
        if (isset($validValues[$value]) && $validValues[$value] === $value) {
            return true;
        }

        return \in_array($value, $validValues, true);
    }
public static function isValid($value): bool
    {
        if (\is_array($value) || \is_object($value)) {
            return false;
        }

        // Get the valid values to compare with
        $validValues = static::validValues();

        // If the value isset in the valid values array and the value matches
        // the value to check
        // ?? Why is this here ??
        // As is known by all isset is faster than in_array. We want to
        // capitalize on that with some enums by making the const VALUES
        // array a key value pair of the value itself so that we've
        // essentially got value => value for each item in the const VALUES
        // array. This way we can take advantage of the quickness of isset over
        // in_array. However, because not all enums may do this we need to
        // ensure if the value isset as the key in the array that it also
        // matches as the value of that item in the array, otherwise we'll
        // get false positives where its a normal array of 0 => value, 1 =>
        // value and we check for 0 being a valid value where it may very
        // well not be valid at all.
        if (isset($validValues[$value]) && $validValues[$value] === $value) {
            return true;
        }

        return \in_array($value, $validValues, true);
    }
Check if the set value on this enum is a valid value for the enum.

@param mixed $value The value to check

@return bool