@@ -482,6 +482,7 @@ private function createMethod(
482
482
$ stubPhpDocParameterVariadicity = [];
483
483
$ phpDocParameterTypes = [];
484
484
$ phpDocReturnType = null ;
485
+ $ stubPhpDocPair = null ;
485
486
if (count ($ variantNumbers ) === 1 ) {
486
487
$ stubPhpDocPair = $ this ->findMethodPhpDocIncludingAncestors ($ declaringClass , $ methodReflection ->getName (), array_map (static function (ParameterSignature $ parameterSignature ): string {
487
488
return $ parameterSignature ->getName ();
@@ -505,36 +506,37 @@ private function createMethod(
505
506
);
506
507
$ stubPhpDocParameterVariadicity [$ name ] = $ paramTag ->isVariadic ();
507
508
}
508
- } elseif ($ reflectionMethod !== null && $ reflectionMethod ->getDocComment () !== false ) {
509
- $ filename = $ reflectionMethod ->getFileName ();
510
- if ($ filename !== false ) {
511
- $ phpDocBlock = $ this ->fileTypeMapper ->getResolvedPhpDoc (
512
- $ filename ,
513
- $ declaringClassName ,
514
- null ,
515
- $ reflectionMethod ->getName (),
516
- $ reflectionMethod ->getDocComment ()
517
- );
518
- $ throwsTag = $ phpDocBlock ->getThrowsTag ();
519
- if ($ throwsTag !== null ) {
520
- $ throwType = $ throwsTag ->getType ();
521
- }
522
- $ returnTag = $ phpDocBlock ->getReturnTag ();
523
- if ($ returnTag !== null ) {
524
- $ phpDocReturnType = $ returnTag ->getType ();
525
- }
526
- foreach ($ phpDocBlock ->getParamTags () as $ name => $ paramTag ) {
527
- $ phpDocParameterTypes [$ name ] = $ paramTag ->getType ();
528
- }
529
-
530
- $ signatureParameters = $ methodSignature ->getParameters ();
531
- foreach ($ reflectionMethod ->getParameters () as $ paramI => $ reflectionParameter ) {
532
- if (!array_key_exists ($ paramI , $ signatureParameters )) {
533
- continue ;
534
- }
509
+ }
510
+ }
511
+ if ($ stubPhpDocPair === null && $ reflectionMethod !== null && $ reflectionMethod ->getDocComment () !== false ) {
512
+ $ filename = $ reflectionMethod ->getFileName ();
513
+ if ($ filename !== false ) {
514
+ $ phpDocBlock = $ this ->fileTypeMapper ->getResolvedPhpDoc (
515
+ $ filename ,
516
+ $ declaringClassName ,
517
+ null ,
518
+ $ reflectionMethod ->getName (),
519
+ $ reflectionMethod ->getDocComment ()
520
+ );
521
+ $ throwsTag = $ phpDocBlock ->getThrowsTag ();
522
+ if ($ throwsTag !== null ) {
523
+ $ throwType = $ throwsTag ->getType ();
524
+ }
525
+ $ returnTag = $ phpDocBlock ->getReturnTag ();
526
+ if ($ returnTag !== null ) {
527
+ $ phpDocReturnType = $ returnTag ->getType ();
528
+ }
529
+ foreach ($ phpDocBlock ->getParamTags () as $ name => $ paramTag ) {
530
+ $ phpDocParameterTypes [$ name ] = $ paramTag ->getType ();
531
+ }
535
532
536
- $ phpDocParameterNameMapping [$ signatureParameters [$ paramI ]->getName ()] = $ reflectionParameter ->getName ();
533
+ $ signatureParameters = $ methodSignature ->getParameters ();
534
+ foreach ($ reflectionMethod ->getParameters () as $ paramI => $ reflectionParameter ) {
535
+ if (!array_key_exists ($ paramI , $ signatureParameters )) {
536
+ continue ;
537
537
}
538
+
539
+ $ phpDocParameterNameMapping [$ signatureParameters [$ paramI ]->getName ()] = $ reflectionParameter ->getName ();
538
540
}
539
541
}
540
542
}
0 commit comments