Skip to content

Commit

Permalink
fix(jsonschema): change type to integer in json schema for int backed…
Browse files Browse the repository at this point in the history
… enums (#5553)
  • Loading branch information
maxtorete committed Apr 20, 2023
1 parent e4fa5a2 commit 62510b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/JsonSchema/TypeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private function getClassType(?string $className, bool $nullable, string $format
if (!$this->isResourceClass($className) && is_a($className, \BackedEnum::class, true)) {
$enumCases = array_map(static fn (\BackedEnum $enum): string|int => $enum->value, $className::cases());

$type = \is_string($enumCases[0] ?? '') ? 'string' : 'int';
$type = \is_string($enumCases[0] ?? '') ? 'string' : 'integer';

if ($nullable) {
$enumCases[] = null;
Expand Down

0 comments on commit 62510b2

Please sign in to comment.