18
18
use phpDocumentor \Reflection \DocBlock \Tags \Reference \Fqsen as FqsenRef ;
19
19
use phpDocumentor \Reflection \DocBlock \Tags \Reference \Reference ;
20
20
use phpDocumentor \Reflection \DocBlock \Tags \Reference \Url ;
21
+ use phpDocumentor \Reflection \Fqsen ;
21
22
use phpDocumentor \Reflection \FqsenResolver ;
22
23
use phpDocumentor \Reflection \Types \Context as TypeContext ;
23
24
use phpDocumentor \Reflection \Utils ;
24
25
use Webmozart \Assert \Assert ;
26
+ use function array_key_exists ;
27
+ use function explode ;
25
28
use function preg_match ;
26
29
27
30
/**
@@ -50,7 +53,6 @@ public static function create(
50
53
?DescriptionFactory $ descriptionFactory = null ,
51
54
?TypeContext $ context = null
52
55
) : self {
53
- Assert::notNull ($ typeResolver );
54
56
Assert::notNull ($ descriptionFactory );
55
57
56
58
$ parts = Utils::pregSplit ('/\s+/Su ' , $ body , 2 );
@@ -61,7 +63,20 @@ public static function create(
61
63
return new static (new Url ($ parts [0 ]), $ description );
62
64
}
63
65
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 ]);
65
80
}
66
81
67
82
/**
0 commit comments