Skip to content

Commit a3d1ad9

Browse files
committed
isValidKey using toArray() directly
Now it doesn't need to use toArray()->array_keys->in_array, but just toArray() and isset[$key], which should be faster.
1 parent e5976f1 commit a3d1ad9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Enum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static function isValid($value)
119119
*/
120120
public static function isValidKey($key)
121121
{
122-
return in_array($key, self::keys(), true);
122+
return isset(self::toArray()[$key]);
123123
}
124124

125125
/**

0 commit comments

Comments
 (0)