Skip to content

Commit 99f9a97

Browse files
authored
Merge pull request #3 from Carnicero90/main
fix: handling int backed enums with zero as backing balue
2 parents 845455d + 5ae9929 commit 99f9a97

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/Traits/EnumFrom.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ public static function wrap(self|string|int|null $value): ?self
2020
}
2121

2222
if (is_string($value) && self::isIntBacked()) {
23-
$tmpValue = intval($value);
24-
if (! empty($tmpValue)) {
25-
$enum = self::tryFrom($tmpValue);
23+
if (is_numeric($value)) {
24+
$enum = self::tryFrom(intval($value));
2625
}
2726
} else {
2827
$enum = self::tryFrom($value);

0 commit comments

Comments
 (0)