@@ -128,18 +128,24 @@ public static function resolvePhpDocBlockForProperty(
128
128
array $ newPositionalParameterNames , // unused
129
129
): self
130
130
{
131
- return self ::resolvePhpDocBlockTree (
132
- $ docComment ,
133
- $ classReflection ,
134
- $ trait ,
131
+ $ docBlocksFromParents = self ::resolveParentPhpDocBlocks (
132
+ self ::getParentReflections ($ classReflection ),
135
133
$ propertyName ,
136
- $ file ,
137
134
'hasNativeProperty ' ,
138
135
'getNativeProperty ' ,
139
136
__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 ,
143
149
);
144
150
}
145
151
@@ -158,18 +164,24 @@ public static function resolvePhpDocBlockForConstant(
158
164
array $ newPositionalParameterNames , // unused
159
165
): self
160
166
{
161
- return self ::resolvePhpDocBlockTree (
162
- $ docComment ,
163
- $ classReflection ,
164
- null ,
167
+ $ docBlocksFromParents = self ::resolveParentPhpDocBlocks (
168
+ self ::getParentReflections ($ classReflection ),
165
169
$ constantName ,
166
- $ file ,
167
170
'hasConstant ' ,
168
171
'getConstant ' ,
169
172
__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 ,
173
185
);
174
186
}
175
187
@@ -188,45 +200,12 @@ public static function resolvePhpDocBlockForMethod(
188
200
array $ newPositionalParameterNames ,
189
201
): self
190
202
{
191
- return self ::resolvePhpDocBlockTree (
192
- $ docComment ,
193
- $ classReflection ,
194
- $ trait ,
203
+ $ docBlocksFromParents = self ::resolveParentPhpDocBlocks (
204
+ self ::getParentReflections ($ classReflection ),
195
205
$ methodName ,
196
- $ file ,
197
206
'hasNativeMethod ' ,
198
207
'getNativeMethod ' ,
199
208
__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 ,
230
209
$ explicit ?? $ docComment !== null ,
231
210
$ newPositionalParameterNames ,
232
211
);
@@ -264,11 +243,12 @@ private static function remapParameterNames(
264
243
}
265
244
266
245
/**
246
+ * @param array<int, ClassReflection> $parentReflections
267
247
* @param array<int, string> $positionalParameterNames
268
248
* @return array<int, self>
269
249
*/
270
250
private static function resolveParentPhpDocBlocks (
271
- ClassReflection $ classReflection ,
251
+ array $ parentReflections ,
272
252
string $ name ,
273
253
string $ hasMethodName ,
274
254
string $ getMethodName ,
@@ -278,7 +258,6 @@ private static function resolveParentPhpDocBlocks(
278
258
): array
279
259
{
280
260
$ result = [];
281
- $ parentReflections = self ::getParentReflections ($ classReflection );
282
261
283
262
foreach ($ parentReflections as $ parentReflection ) {
284
263
$ oneResult = self ::resolvePhpDocBlockFromClass (
0 commit comments