Skip to content

Commit

Permalink
Use instanceof instead of is_a()
Browse files Browse the repository at this point in the history
  • Loading branch information
iksss-invia committed Feb 20, 2024
1 parent 91d59c7 commit 3a3518a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Handler/EnumHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function serializeEnum(
array $type,
SerializationContext $context
) {
if ((isset($type['params'][1]) && 'value' === $type['params'][1]) || (!isset($type['params'][1]) && is_a($enum, \BackedEnum::class, true))) {
if ((isset($type['params'][1]) && 'value' === $type['params'][1]) || (!isset($type['params'][1]) && $enum instanceof \BackedEnum)) {
if (!$enum instanceof \BackedEnum) {
throw new InvalidMetadataException(sprintf('The type "%s" is not a backed enum, thus you can not use "value" as serialization mode for its value.', get_class($enum)));
}
Expand Down

0 comments on commit 3a3518a

Please sign in to comment.