1
0
Fork 0
mirror of https://github.com/archtechx/enums.git synced 2025-12-12 12:14:03 +00:00

Simplify control flow

This commit is contained in:
Mark 2024-12-29 07:25:31 +01:00
parent 5db9997149
commit 2e5c94b4ec
No known key found for this signature in database
GPG key ID: 79CFF7869BD39873

View file

@ -29,13 +29,11 @@ trait Options
if ($firstCase === null) { if ($firstCase === null) {
return ''; return '';
} elseif ($firstCase instanceof BackedEnum) { }
// [name => value]
$options = static::options();
} else {
// [name, name] // [name, name]
$options = static::options(); $options = static::options();
if (!$firstCase instanceof BackedEnum) {
// [name => name, name => name] // [name => name, name => name]
$options = array_combine($options, $options); $options = array_combine($options, $options);
} }