@@ -965,12 +965,8 @@ public function getEnumCases(): array
965965 $ initializerExprContext = InitializerExprContext::fromClassReflection ($ this );
966966 foreach ($ this ->reflection ->getCases () as $ case ) {
967967 $ valueType = null ;
968- if ($ case instanceof ReflectionEnumBackedCase) {
969- try {
970- $ valueType = $ this ->initializerExprTypeResolver ->getType ($ case ->getValueExpression (), $ initializerExprContext );
971- } catch (LogicException ) {
972- // Enum case does not have a value
973- }
968+ if ($ case instanceof ReflectionEnumBackedCase && $ case ->hasValueExpression ()) {
969+ $ valueType = $ this ->initializerExprTypeResolver ->getType ($ case ->getValueExpression (), $ initializerExprContext );
974970 }
975971 $ caseName = $ case ->getName ();
976972 $ attributes = $ this ->attributeReflectionFactory ->fromNativeReflection ($ case ->getAttributes (), InitializerExprContext::fromClass ($ this ->getName (), $ this ->getFileName ()));
@@ -996,12 +992,8 @@ public function getEnumCase(string $name): EnumCaseReflection
996992
997993 $ case = $ this ->reflection ->getCase ($ name );
998994 $ valueType = null ;
999- if ($ case instanceof ReflectionEnumBackedCase) {
1000- try {
1001- $ valueType = $ this ->initializerExprTypeResolver ->getType ($ case ->getValueExpression (), InitializerExprContext::fromClassReflection ($ this ));
1002- } catch (LogicException ) {
1003- // Enum case does not have a value
1004- }
995+ if ($ case instanceof ReflectionEnumBackedCase && $ case ->hasValueExpression ()) {
996+ $ valueType = $ this ->initializerExprTypeResolver ->getType ($ case ->getValueExpression (), InitializerExprContext::fromClassReflection ($ this ));
1005997 }
1006998
1007999 $ attributes = $ this ->attributeReflectionFactory ->fromNativeReflection ($ case ->getAttributes (), InitializerExprContext::fromClass ($ this ->getName (), $ this ->getFileName ()));
0 commit comments