mirror of
https://github.com/archtechx/enums.git
synced 2025-12-12 08:04:04 +00:00
Simplify control flow
This commit is contained in:
parent
5db9997149
commit
2e5c94b4ec
1 changed files with 4 additions and 6 deletions
|
|
@ -29,13 +29,11 @@ trait Options
|
|||
|
||||
if ($firstCase === null) {
|
||||
return '';
|
||||
} elseif ($firstCase instanceof BackedEnum) {
|
||||
// [name => value]
|
||||
$options = static::options();
|
||||
} else {
|
||||
// [name, name]
|
||||
$options = static::options();
|
||||
}
|
||||
|
||||
// [name, name]
|
||||
$options = static::options();
|
||||
if (!$firstCase instanceof BackedEnum) {
|
||||
// [name => name, name => name]
|
||||
$options = array_combine($options, $options);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue