@@ -128,18 +128,24 @@ public static function resolvePhpDocBlockForProperty(
128128 array $ newPositionalParameterNames , // unused
129129 ): self
130130 {
131- return self ::resolvePhpDocBlockTree (
132- $ docComment ,
133- $ classReflection ,
134- $ trait ,
131+ $ docBlocksFromParents = self ::resolveParentPhpDocBlocks (
132+ self ::getParentReflections ($ classReflection ),
135133 $ propertyName ,
136- $ file ,
137134 'hasNativeProperty ' ,
138135 'getNativeProperty ' ,
139136 __FUNCTION__ ,
140- $ explicit ,
141- [],
142- [],
137+ $ explicit ?? $ docComment !== null ,
138+ $ newPositionalParameterNames ,
139+ );
140+
141+ return new self (
142+ $ docComment ?? ResolvedPhpDocBlock::EMPTY_DOC_STRING ,
143+ $ file ,
144+ $ classReflection ,
145+ $ trait ,
146+ $ explicit ?? true ,
147+ self ::remapParameterNames ($ originalPositionalParameterNames , $ newPositionalParameterNames ),
148+ $ docBlocksFromParents ,
143149 );
144150 }
145151
@@ -158,18 +164,24 @@ public static function resolvePhpDocBlockForConstant(
158164 array $ newPositionalParameterNames , // unused
159165 ): self
160166 {
161- return self ::resolvePhpDocBlockTree (
162- $ docComment ,
163- $ classReflection ,
164- null ,
167+ $ docBlocksFromParents = self ::resolveParentPhpDocBlocks (
168+ self ::getParentReflections ($ classReflection ),
165169 $ constantName ,
166- $ file ,
167170 'hasConstant ' ,
168171 'getConstant ' ,
169172 __FUNCTION__ ,
170- $ explicit ,
171- [],
172- [],
173+ $ explicit ?? $ docComment !== null ,
174+ $ newPositionalParameterNames ,
175+ );
176+
177+ return new self (
178+ $ docComment ?? ResolvedPhpDocBlock::EMPTY_DOC_STRING ,
179+ $ file ,
180+ $ classReflection ,
181+ $ trait ,
182+ $ explicit ?? true ,
183+ self ::remapParameterNames ($ originalPositionalParameterNames , $ newPositionalParameterNames ),
184+ $ docBlocksFromParents ,
173185 );
174186 }
175187
@@ -188,45 +200,12 @@ public static function resolvePhpDocBlockForMethod(
188200 array $ newPositionalParameterNames ,
189201 ): self
190202 {
191- return self ::resolvePhpDocBlockTree (
192- $ docComment ,
193- $ classReflection ,
194- $ trait ,
203+ $ docBlocksFromParents = self ::resolveParentPhpDocBlocks (
204+ self ::getParentReflections ($ classReflection ),
195205 $ methodName ,
196- $ file ,
197206 'hasNativeMethod ' ,
198207 'getNativeMethod ' ,
199208 __FUNCTION__ ,
200- $ explicit ,
201- $ originalPositionalParameterNames ,
202- $ newPositionalParameterNames ,
203- );
204- }
205-
206- /**
207- * @param array<int, string> $originalPositionalParameterNames
208- * @param array<int, string> $newPositionalParameterNames
209- */
210- private static function resolvePhpDocBlockTree (
211- ?string $ docComment ,
212- ClassReflection $ classReflection ,
213- ?string $ trait ,
214- string $ name ,
215- ?string $ file ,
216- string $ hasMethodName ,
217- string $ getMethodName ,
218- string $ resolveMethodName ,
219- ?bool $ explicit ,
220- array $ originalPositionalParameterNames ,
221- array $ newPositionalParameterNames ,
222- ): self
223- {
224- $ docBlocksFromParents = self ::resolveParentPhpDocBlocks (
225- $ classReflection ,
226- $ name ,
227- $ hasMethodName ,
228- $ getMethodName ,
229- $ resolveMethodName ,
230209 $ explicit ?? $ docComment !== null ,
231210 $ newPositionalParameterNames ,
232211 );
@@ -264,11 +243,12 @@ private static function remapParameterNames(
264243 }
265244
266245 /**
246+ * @param array<int, ClassReflection> $parentReflections
267247 * @param array<int, string> $positionalParameterNames
268248 * @return array<int, self>
269249 */
270250 private static function resolveParentPhpDocBlocks (
271- ClassReflection $ classReflection ,
251+ array $ parentReflections ,
272252 string $ name ,
273253 string $ hasMethodName ,
274254 string $ getMethodName ,
@@ -278,7 +258,6 @@ private static function resolveParentPhpDocBlocks(
278258 ): array
279259 {
280260 $ result = [];
281- $ parentReflections = self ::getParentReflections ($ classReflection );
282261
283262 foreach ($ parentReflections as $ parentReflection ) {
284263 $ oneResult = self ::resolvePhpDocBlockFromClass (
0 commit comments