@@ -965,12 +965,8 @@ public function getEnumCases(): array
965
965
$ initializerExprContext = InitializerExprContext::fromClassReflection ($ this );
966
966
foreach ($ this ->reflection ->getCases () as $ case ) {
967
967
$ 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 );
974
970
}
975
971
$ caseName = $ case ->getName ();
976
972
$ attributes = $ this ->attributeReflectionFactory ->fromNativeReflection ($ case ->getAttributes (), InitializerExprContext::fromClass ($ this ->getName (), $ this ->getFileName ()));
@@ -996,12 +992,8 @@ public function getEnumCase(string $name): EnumCaseReflection
996
992
997
993
$ case = $ this ->reflection ->getCase ($ name );
998
994
$ 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 ));
1005
997
}
1006
998
1007
999
$ attributes = $ this ->attributeReflectionFactory ->fromNativeReflection ($ case ->getAttributes (), InitializerExprContext::fromClass ($ this ->getName (), $ this ->getFileName ()));
0 commit comments