File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,26 +117,24 @@ public static function key(Type $type): ?string
117117 // fold in a subtracted type, which equals() ignores).
118118 $ enumCaseObject = $ type ->getEnumCaseObject ();
119119 if ($ enumCaseObject !== null && $ enumCaseObject ->equals ($ type )) {
120- return self ::kind ( $ type ) . ':: ' . $ enumCaseObject ->getEnumCaseName ();
120+ return self ::ENUM_CASE_KEY_PREFIX . $ enumCaseObject -> getClassName () . ':: ' . $ enumCaseObject ->getEnumCaseName ();
121121 }
122122
123123 $ scalarTypes = $ type ->getConstantScalarTypes ();
124- if (count ($ scalarTypes ) !== 1 || !$ scalarTypes [0 ]->equals ($ type )) {
125- return null ;
126- }
127-
128- $ value = $ scalarTypes [0 ]->getValue ();
129- if ($ value === null ) {
130- return self ::NULL_KEY ;
131- }
132- if (is_int ($ value )) {
133- return self ::INTEGER_KEY_PREFIX . $ value ;
134- }
135- if (is_bool ($ value )) {
136- return self ::BOOLEAN_KEY_PREFIX . ($ value ? '1 ' : '0 ' );
137- }
138- if (is_string ($ value )) {
139- return self ::STRING_KEY_PREFIX . $ value ;
124+ if (count ($ scalarTypes ) === 1 && $ scalarTypes [0 ]->equals ($ type )) {
125+ $ value = $ scalarTypes [0 ]->getValue ();
126+ if ($ value === null ) {
127+ return self ::NULL_KEY ;
128+ }
129+ if (is_int ($ value )) {
130+ return self ::INTEGER_KEY_PREFIX . $ value ;
131+ }
132+ if (is_bool ($ value )) {
133+ return self ::BOOLEAN_KEY_PREFIX . ($ value ? '1 ' : '0 ' );
134+ }
135+ if (is_string ($ value )) {
136+ return self ::STRING_KEY_PREFIX . $ value ;
137+ }
140138 }
141139
142140 return null ;
You can’t perform that action at this time.
0 commit comments