Skip to content

Commit 1a41d59

Browse files
authored
Fix Backed Enum Helpers Return Value (#16)
1 parent 1520166 commit 1a41d59

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ObjectHelpers/enum_helpers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ function enum_string(BackedEnum $enum): string
1818
throw new InvalidArgumentException('IntBackedEnum Prohibited.');
1919
}
2020

21-
return $enum->name;
21+
return $enum->value;
2222
}
2323
}
2424

2525
if (!function_exists('enum_int')) {
26-
function enum_int(BackedEnum $enum): string
26+
function enum_int(BackedEnum $enum): int
2727
{
2828
if (is_string($enum->value)) {
2929
throw new InvalidArgumentException('StringBackEnum Prohibited.');
3030
}
3131

32-
return $enum->name;
32+
return $enum->value;
3333
}
3434
}

0 commit comments

Comments
 (0)