Skip to content

Commit

Permalink
Merge pull request #87 from jameshulse/patch-1
Browse files Browse the repository at this point in the history
Don't generate if an enum has no cases yet
  • Loading branch information
rubenvanassche authored Oct 4, 2024
2 parents 4e1b7a1 + c3000cb commit bba3a3d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Transformers/EnumTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public function transform(ReflectionClass $class, string $name): ?TransformedTyp
return null;
}

if (empty($enum->getCases())) {
return null;
}

return $this->config->shouldTransformToNativeEnums()
? $this->toEnum($enum, $name)
: $this->toType($enum, $name);
Expand Down

0 comments on commit bba3a3d

Please sign in to comment.