| Conditions | 2 |
| Paths | 2 |
| Total Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 39 | public function __construct(string $enumClass, bool $useKey = false) |
|
| 27 | { |
||
| 28 | 39 | if (! is_subclass_of($enumClass, Enum::class)) { |
|
| 29 | 6 | throw new InvalidArgumentException("Value '$enumClass' is not an enum class"); |
|
| 30 | } |
||
| 31 | |||
| 32 | 33 | $this->useKey = $useKey; |
|
| 33 | 33 | $this->enumClass = $enumClass; |
|
| 34 | 33 | } |
|
| 35 | |||
| 60 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.