16
16
use ArrayIterator ;
17
17
use InvalidArgumentException ;
18
18
use phpDocumentor \Reflection \Types \Array_ ;
19
+ use phpDocumentor \Reflection \Types \ArrayKey ;
19
20
use phpDocumentor \Reflection \Types \ClassString ;
20
21
use phpDocumentor \Reflection \Types \Collection ;
21
22
use phpDocumentor \Reflection \Types \Compound ;
@@ -102,6 +103,7 @@ final class TypeResolver
102
103
'callable-string ' => PseudoTypes \CallableString::class,
103
104
'false ' => PseudoTypes \False_::class,
104
105
'true ' => PseudoTypes \True_::class,
106
+ 'literal-string ' => PseudoTypes \LiteralString::class,
105
107
'self ' => Types \Self_::class,
106
108
'$this ' => Types \This::class,
107
109
'static ' => Types \Static_::class,
@@ -543,6 +545,7 @@ private function resolveCollection(ArrayIterator $tokens, Type $classType, Conte
543
545
// check the key type for an "array" collection. We allow only
544
546
// strings or integers.
545
547
if (
548
+ !$ keyType instanceof ArrayKey &&
546
549
!$ keyType instanceof String_ &&
547
550
!$ keyType instanceof Integer &&
548
551
!$ keyType instanceof Compound
@@ -555,6 +558,7 @@ private function resolveCollection(ArrayIterator $tokens, Type $classType, Conte
555
558
if ($ keyType instanceof Compound) {
556
559
foreach ($ keyType ->getIterator () as $ item ) {
557
560
if (
561
+ !$ item instanceof ArrayKey &&
558
562
!$ item instanceof String_ &&
559
563
!$ item instanceof Integer
560
564
) {
0 commit comments