1818use phpDocumentor \Reflection \DocBlock \Tags \Reference \Fqsen as FqsenRef ;
1919use phpDocumentor \Reflection \DocBlock \Tags \Reference \Reference ;
2020use phpDocumentor \Reflection \DocBlock \Tags \Reference \Url ;
21+ use phpDocumentor \Reflection \Fqsen ;
2122use phpDocumentor \Reflection \FqsenResolver ;
2223use phpDocumentor \Reflection \Types \Context as TypeContext ;
2324use phpDocumentor \Reflection \Utils ;
2425use Webmozart \Assert \Assert ;
26+ use function array_key_exists ;
27+ use function explode ;
2528use function preg_match ;
2629
2730/**
@@ -50,7 +53,6 @@ public static function create(
5053 ?DescriptionFactory $ descriptionFactory = null ,
5154 ?TypeContext $ context = null
5255 ) : self {
53- Assert::notNull ($ typeResolver );
5456 Assert::notNull ($ descriptionFactory );
5557
5658 $ parts = Utils::pregSplit ('/\s+/Su ' , $ body , 2 );
@@ -61,7 +63,20 @@ public static function create(
6163 return new static (new Url ($ parts [0 ]), $ description );
6264 }
6365
64- return new static (new FqsenRef ($ typeResolver ->resolve ($ parts [0 ], $ context )), $ description );
66+ return new static (new FqsenRef (self ::resolveFqsen ($ parts [0 ], $ typeResolver , $ context )), $ description );
67+ }
68+
69+ private static function resolveFqsen (string $ parts , ?FqsenResolver $ fqsenResolver , ?TypeContext $ context ) : Fqsen
70+ {
71+ Assert::notNull ($ fqsenResolver );
72+ $ fqsenParts = explode (':: ' , $ parts );
73+ $ resolved = $ fqsenResolver ->resolve ($ fqsenParts [0 ], $ context );
74+
75+ if (!array_key_exists (1 , $ fqsenParts )) {
76+ return $ resolved ;
77+ }
78+
79+ return new Fqsen ($ resolved . ':: ' . $ fqsenParts [1 ]);
6580 }
6681
6782 /**
0 commit comments