|
7 | 7 | use PHPStan\Reflection\ExtendedMethodReflection;
|
8 | 8 | use PHPStan\Reflection\FunctionVariant;
|
9 | 9 | use PHPStan\Reflection\ParameterReflection;
|
| 10 | +use PHPStan\Reflection\ParameterReflectionWithPhpDocs; |
10 | 11 | use PHPStan\Reflection\ParametersAcceptor;
|
11 | 12 | use PHPStan\Reflection\Php\DummyParameter;
|
| 13 | +use PHPStan\Reflection\Php\DummyParameterWithPhpDocs; |
12 | 14 | use PHPStan\Reflection\ResolvedMethodReflection;
|
13 | 15 | use PHPStan\Type\Type;
|
14 | 16 | use function array_map;
|
@@ -83,14 +85,33 @@ private function transformMethodWithStaticType(ClassReflection $declaringClass,
|
83 | 85 | $variants = array_map(fn (ParametersAcceptor $acceptor): ParametersAcceptor => new FunctionVariant(
|
84 | 86 | $acceptor->getTemplateTypeMap(),
|
85 | 87 | $acceptor->getResolvedTemplateTypeMap(),
|
86 |
| - array_map(fn (ParameterReflection $parameter): ParameterReflection => new DummyParameter( |
87 |
| - $parameter->getName(), |
88 |
| - $this->transformStaticType($parameter->getType()), |
89 |
| - $parameter->isOptional(), |
90 |
| - $parameter->passedByReference(), |
91 |
| - $parameter->isVariadic(), |
92 |
| - $parameter->getDefaultValue(), |
93 |
| - ), $acceptor->getParameters()), |
| 88 | + array_map( |
| 89 | + function (ParameterReflection $parameter): ParameterReflection { |
| 90 | + if ($parameter instanceof ParameterReflectionWithPhpDocs) { |
| 91 | + return new DummyParameterWithPhpDocs( |
| 92 | + $parameter->getName(), |
| 93 | + $this->transformStaticType($parameter->getType()), |
| 94 | + $parameter->isOptional(), |
| 95 | + $parameter->passedByReference(), |
| 96 | + $parameter->isVariadic(), |
| 97 | + $parameter->getDefaultValue(), |
| 98 | + $parameter->getNativeType(), |
| 99 | + $parameter->getPhpDocType(), |
| 100 | + $parameter->getOutType(), |
| 101 | + ); |
| 102 | + } |
| 103 | + |
| 104 | + return new DummyParameter( |
| 105 | + $parameter->getName(), |
| 106 | + $this->transformStaticType($parameter->getType()), |
| 107 | + $parameter->isOptional(), |
| 108 | + $parameter->passedByReference(), |
| 109 | + $parameter->isVariadic(), |
| 110 | + $parameter->getDefaultValue(), |
| 111 | + ); |
| 112 | + }, |
| 113 | + $acceptor->getParameters(), |
| 114 | + ), |
94 | 115 | $acceptor->isVariadic(),
|
95 | 116 | $this->transformStaticType($acceptor->getReturnType()),
|
96 | 117 | ), $method->getVariants());
|
|
0 commit comments