You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Symfony Validator constraint that validates of given strings a valid cases in a given PHP 8 Enum
3
+
4
+
```
5
+
enum ContactCategory: string
6
+
{
7
+
case Child = 'Child';
8
+
case Grandchild = 'Grandchild';
9
+
}
10
+
11
+
use Muffe\EnumConstraint\Constraints\Enum;
12
+
13
+
#[
14
+
Enum(
15
+
enumType: ContactCategory::class,
16
+
)
17
+
]
18
+
public ?string $category = null;
19
+
```
20
+
21
+
Validates that $category contains a string that is equal to the backed value of one of the given enum cases, or the name of the case if no backed values are given.
0 commit comments