@@ -109,21 +109,35 @@ public function getResolvedPhpDoc(
109
109
return $ this ->createResolvedPhpDocBlock ($ phpDocKey , $ nameScopeMap [$ nameScopeKey ], $ docComment , $ fileName );
110
110
}
111
111
112
+ $ keyFileName = $ fileName ;
112
113
if (!isset ($ this ->inProcess [$ fileName ][$ nameScopeKey ])) { // wrong $fileName due to traits
114
+ if (!is_null ($ className )) {
115
+ $ reflectionProvider = $ this ->reflectionProviderProvider ->getReflectionProvider ();
116
+ if ($ reflectionProvider ->hasClass ($ className )) {
117
+ $ classFileName = $ reflectionProvider ->getClass ($ className )->getFileName ();
118
+ $ nameScopeKeyCandidate = $ this ->getNameScopeKey ($ classFileName , $ className , $ traitName , $ functionName );
119
+ if (isset ($ this ->inProcess [$ classFileName ][$ nameScopeKeyCandidate ])) {
120
+ $ keyFileName = $ classFileName ;
121
+ $ nameScopeKey = $ nameScopeKeyCandidate ;
122
+ }
123
+ }
124
+ }
125
+ }
126
+ if (!isset ($ this ->inProcess [$ keyFileName ][$ nameScopeKey ])) {
113
127
return ResolvedPhpDocBlock::createEmpty ();
114
128
}
115
129
116
- if ($ this ->inProcess [$ fileName ][$ nameScopeKey ] === true ) { // PHPDoc has cyclic dependency
130
+ if ($ this ->inProcess [$ keyFileName ][$ nameScopeKey ] === true ) { // PHPDoc has cyclic dependency
117
131
return ResolvedPhpDocBlock::createEmpty ();
118
132
}
119
133
120
- if (is_callable ($ this ->inProcess [$ fileName ][$ nameScopeKey ])) {
121
- $ resolveCallback = $ this ->inProcess [$ fileName ][$ nameScopeKey ];
122
- $ this ->inProcess [$ fileName ][$ nameScopeKey ] = true ;
123
- $ this ->inProcess [$ fileName ][$ nameScopeKey ] = $ resolveCallback ();
134
+ if (is_callable ($ this ->inProcess [$ keyFileName ][$ nameScopeKey ])) {
135
+ $ resolveCallback = $ this ->inProcess [$ keyFileName ][$ nameScopeKey ];
136
+ $ this ->inProcess [$ keyFileName ][$ nameScopeKey ] = true ;
137
+ $ this ->inProcess [$ keyFileName ][$ nameScopeKey ] = $ resolveCallback ();
124
138
}
125
139
126
- return $ this ->createResolvedPhpDocBlock ($ phpDocKey , $ this ->inProcess [$ fileName ][$ nameScopeKey ], $ docComment , $ fileName );
140
+ return $ this ->createResolvedPhpDocBlock ($ phpDocKey , $ this ->inProcess [$ keyFileName ][$ nameScopeKey ], $ docComment , $ fileName );
127
141
}
128
142
129
143
private function createResolvedPhpDocBlock (string $ phpDocKey , NameScope $ nameScope , string $ phpDocString , ?string $ fileName ): ResolvedPhpDocBlock
0 commit comments