2626use phpDocumentor \Reflection \Types \InterfaceString ;
2727use phpDocumentor \Reflection \Types \Intersection ;
2828use phpDocumentor \Reflection \Types \Iterable_ ;
29+ use phpDocumentor \Reflection \PseudoTypes \List_ ;
2930use phpDocumentor \Reflection \Types \Nullable ;
3031use phpDocumentor \Reflection \Types \Object_ ;
3132use phpDocumentor \Reflection \Types \String_ ;
@@ -521,10 +522,11 @@ private function resolveCollection(ArrayIterator $tokens, Type $classType, Conte
521522 {
522523 $ isArray = ((string ) $ classType === 'array ' );
523524 $ isIterable = ((string ) $ classType === 'iterable ' );
525+ $ isList = ((string ) $ classType === 'list ' );
524526
525527 // allow only "array", "iterable" or class name before "<"
526528 if (
527- !$ isArray && !$ isIterable
529+ !$ isArray && !$ isIterable && ! $ isList
528530 && (!$ classType instanceof Object_ || $ classType ->getFqsen () === null )
529531 ) {
530532 throw new RuntimeException (
@@ -538,7 +540,7 @@ private function resolveCollection(ArrayIterator $tokens, Type $classType, Conte
538540 $ keyType = null ;
539541
540542 $ token = $ tokens ->current ();
541- if ($ token !== null && trim ($ token ) === ', ' ) {
543+ if ($ token !== null && trim ($ token ) === ', ' && ! $ isList ) {
542544 // if we have a comma, then we just parsed the key type, not the value type
543545 $ keyType = $ valueType ;
544546 if ($ isArray ) {
@@ -596,6 +598,10 @@ private function resolveCollection(ArrayIterator $tokens, Type $classType, Conte
596598 return new Iterable_ ($ valueType , $ keyType );
597599 }
598600
601+ if ($ isList ) {
602+ return new List_ ($ valueType );
603+ }
604+
599605 if ($ classType instanceof Object_) {
600606 return $ this ->makeCollectionFromObject ($ classType , $ valueType , $ keyType );
601607 }
0 commit comments