Skip to content

Commit d65cabd

Browse files
committed
minor #60980 [TypeInfo] Optimize enum check (norkunas)
This PR was merged into the 7.3 branch. Discussion ---------- [TypeInfo] Optimize enum check | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Fix #60956 (comment) | License | MIT Commits ------- e8b8282 [TypeInfo] Optimize enum check
2 parents d8a673a + e8b8282 commit d65cabd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/TypeInfo/TypeFactoryTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ public static function fromValue(mixed $value): Type
412412
}
413413

414414
$type = match (true) {
415-
\is_object($value) && is_subclass_of($value::class, \UnitEnum::class) => Type::enum($value::class),
415+
$value instanceof \UnitEnum => Type::enum($value::class),
416416
\is_object($value) => \stdClass::class === $value::class ? self::object() : self::object($value::class),
417417
\is_array($value) => self::builtin(TypeIdentifier::ARRAY),
418418
default => null,

0 commit comments

Comments
 (0)