Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
WordGender
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 fromString
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Enum;
4
5/**
6 * @author Wilhelm Zwertvaegher
7 */
8enum WordGender: string implements Enum
9{
10    case M = 'M';
11    case F = 'F';
12    // by definition no defined gender, which means it can be used as both M and F
13    case NEUTRAL = 'NEUTRAL';
14    // gender may be automatically adapted with a locale based strategy
15    case AUTO = 'AUTO';
16
17    public static function fromString(string $value): WordGender
18    {
19        $normalized = strtoupper($value);
20
21        return self::from($normalized);
22    }
23}