1616use ArrayIterator ;
1717use InvalidArgumentException ;
1818use phpDocumentor \Reflection \Types \Array_ ;
19+ use phpDocumentor \Reflection \Types \ArrayKey ;
1920use phpDocumentor \Reflection \Types \ClassString ;
2021use phpDocumentor \Reflection \Types \Collection ;
2122use phpDocumentor \Reflection \Types \Compound ;
@@ -102,6 +103,7 @@ final class TypeResolver
102103 'callable-string ' => PseudoTypes \CallableString::class,
103104 'false ' => PseudoTypes \False_::class,
104105 'true ' => PseudoTypes \True_::class,
106+ 'literal-string ' => PseudoTypes \LiteralString::class,
105107 'self ' => Types \Self_::class,
106108 '$this ' => Types \This::class,
107109 'static ' => Types \Static_::class,
@@ -543,6 +545,7 @@ private function resolveCollection(ArrayIterator $tokens, Type $classType, Conte
543545 // check the key type for an "array" collection. We allow only
544546 // strings or integers.
545547 if (
548+ !$ keyType instanceof ArrayKey &&
546549 !$ keyType instanceof String_ &&
547550 !$ keyType instanceof Integer &&
548551 !$ keyType instanceof Compound
@@ -555,6 +558,7 @@ private function resolveCollection(ArrayIterator $tokens, Type $classType, Conte
555558 if ($ keyType instanceof Compound) {
556559 foreach ($ keyType ->getIterator () as $ item ) {
557560 if (
561+ !$ item instanceof ArrayKey &&
558562 !$ item instanceof String_ &&
559563 !$ item instanceof Integer
560564 ) {
0 commit comments