From 3a3518a5b568cd2919ed95b3d749ba823ad52140 Mon Sep 17 00:00:00 2001 From: Jakub Pastuszek Date: Tue, 20 Feb 2024 16:31:44 +0100 Subject: [PATCH] Use instanceof instead of is_a() --- src/Handler/EnumHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Handler/EnumHandler.php b/src/Handler/EnumHandler.php index 916f3b8d7..44e223bed 100644 --- a/src/Handler/EnumHandler.php +++ b/src/Handler/EnumHandler.php @@ -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))); }