We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5b66b22 commit a93449bCopy full SHA for a93449b
src/Enum.php
@@ -153,6 +153,18 @@ public static function search($value)
153
return array_search($value, static::toArray(), true);
154
}
155
156
+ /**
157
+ * Return new instance by value
158
+ *
159
+ * @param $value
160
161
+ * @return static
162
+ */
163
+ public static function byValue($value)
164
+ {
165
+ return new static($value);
166
+ }
167
+
168
/**
169
* Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a class constant
170
*
0 commit comments